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.
5 6 7 8 |
# File 'lib/Olib/core/extender.rb', line 5 def initialize(item) self.__extend__(item) @type = item.type end |
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/Olib/core/extender.rb', line 4 def type @type end |
Instance Method Details
#__extend__(item) ⇒ Object
This copies GameObj data to attributes so we can employ it for scripting
11 12 13 14 15 16 17 |
# File 'lib/Olib/core/extender.rb', line 11 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
24 25 26 |
# File 'lib/Olib/core/extender.rb', line 24 def at fput "look at ##{@id}" end |
#echo ⇒ Object
19 20 21 22 |
# File 'lib/Olib/core/extender.rb', line 19 def echo respond self self end |