module Tracksperanto::BlockInit

Implements the conventional constructor with “hash of attributes” and block support

Public Class Methods

new(attributes = {}) { |self| ... } click to toggle source
# File lib/tracksperanto/block_init.rb, line 3
def initialize(attributes = {})
  attributes.map { |(k, v)| public_send("#{k}=", v) }
  yield(self) if block_given?
end