Class: Olib::Gameobj_Extender
- Inherits:
-
Object
- Object
- Olib::Gameobj_Extender
- Defined in:
- lib/Olib/core/extender.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#__extend__(item) ⇒ Object
This copies GameObj data to attributes so we can employ it for scripting.
- #at ⇒ Object
- #echo ⇒ Object
-
#initialize(item) ⇒ Gameobj_Extender
constructor
A new instance of Gameobj_Extender.
Constructor Details
#initialize(item) ⇒ Gameobj_Extender
Returns a new instance of Gameobj_Extender.
6 7 8 9 |
# File 'lib/Olib/core/extender.rb', line 6 def initialize(item) self.__extend__(item) @type = item.type end |
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/Olib/core/extender.rb', line 5 def type @type end |
Instance Method Details
#__extend__(item) ⇒ Object
This copies GameObj data to attributes so we can employ it for scripting
12 13 14 15 16 17 18 |
# File 'lib/Olib/core/extender.rb', line 12 def __extend__(item) item.instance_variables.each { |var| s = var.to_s.sub('@', '') (class << self; self end).class_eval do; attr_accessor "#{s}"; end instance_variable_set "#{var}", item.send(s) } end |
#at ⇒ Object
25 26 27 |
# File 'lib/Olib/core/extender.rb', line 25 def at fput "look at ##{@id}" end |
#echo ⇒ Object
20 21 22 23 |
# File 'lib/Olib/core/extender.rb', line 20 def echo respond self self end |