Module: Tracksperanto::BlockInit

Included in:
Import::Base, Keyframe, Parameters::Parameter, Pipeline::Base, Tool::Base, Tracker
Defined in:
lib/tracksperanto/block_init.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#initialize(object_attribute_hash = {}) {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



4
5
6
7
8
# File 'lib/tracksperanto/block_init.rb', line 4

def initialize(object_attribute_hash = {})
  m = method(respond_to?(:public_send) ? :public_send : :send)
  object_attribute_hash.map { |(k, v)| m.call("#{k}=", v) }
  yield(self) if block_given?
end