Class: SDL::Receivers::Receiver
- Inherits:
-
Object
- Object
- SDL::Receivers::Receiver
- Defined in:
- lib/sdl/receivers/receiver.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#compendium ⇒ Object
readonly
Returns the value of attribute compendium.
Instance Method Summary collapse
-
#initialize(compendium) ⇒ Receiver
constructor
A new instance of Receiver.
- #set_value(type_class, type_instance, *property_values) ⇒ Object
Constructor Details
#initialize(compendium) ⇒ Receiver
Returns a new instance of Receiver.
5 6 7 |
# File 'lib/sdl/receivers/receiver.rb', line 5 def initialize(compendium) @compendium = compendium end |
Instance Attribute Details
#compendium ⇒ Object (readonly)
Returns the value of attribute compendium.
3 4 5 |
# File 'lib/sdl/receivers/receiver.rb', line 3 def compendium @compendium end |
Instance Method Details
#set_value(type_class, type_instance, *property_values) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/sdl/receivers/receiver.rb', line 9 def set_value(type_class, type_instance, *property_values) property_values.zip(type_class.properties(true)).each do |value, property| if(value.is_a?(Hash)) TypeInstanceReceiver.new(type_instance, @compendium).send(value.keys.first.to_s, value.values.first) else raise "Specified value '#{value}' for non-existing property." unless property TypeInstanceReceiver.new(type_instance, @compendium).send(property.name, value) end end end |