Class: Runcible::Wrapper
- Inherits:
-
Object
- Object
- Runcible::Wrapper
- Defined in:
- lib/runcible/instance.rb
Overview
Wrapper class to provide access to instances
Instance Method Summary collapse
-
#initialize(name) ⇒ Wrapper
constructor
A new instance of Wrapper.
- #set_instance(attr_name, instance) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name) ⇒ Wrapper
Returns a new instance of Wrapper.
114 115 116 117 |
# File 'lib/runcible/instance.rb', line 114 def initialize(name) @name = name @methods = [] end |
Instance Method Details
#set_instance(attr_name, instance) ⇒ Object
119 120 121 122 |
# File 'lib/runcible/instance.rb', line 119 def set_instance(attr_name, instance) @methods << attr_name define_singleton_method(attr_name) { instance } end |
#to_s ⇒ Object
124 125 126 |
# File 'lib/runcible/instance.rb', line 124 def to_s "#{@name} - #{@methods.uniq.sort.to_s}" end |