Class: Runcible::Wrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/runcible/instance.rb

Overview

Wrapper class to provide access to instances

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Wrapper

Returns a new instance of Wrapper.



112
113
114
115
# File 'lib/runcible/instance.rb', line 112

def initialize(name)
  @name = name
  @methods = []
end

Instance Method Details

#set_instance(attr_name, instance) ⇒ Object



117
118
119
120
# File 'lib/runcible/instance.rb', line 117

def set_instance(attr_name, instance)
  @methods << attr_name
  define_singleton_method(attr_name) { instance }
end

#to_sObject



122
123
124
# File 'lib/runcible/instance.rb', line 122

def to_s
  "#{@name} - #{@methods.uniq.sort.to_s}"
end