Method: Object#set_attr
- Defined in:
- lib/el4r/el4r-sub.rb
#set_attr(ivar_name, init_value) ⇒ Object
Defines a singleton attribute. for testing purpose.
271 272 273 274 |
# File 'lib/el4r/el4r-sub.rb', line 271 def set_attr(ivar_name, init_value) eval("class << self; attr_accessor :#{ivar_name} end") self.instance_variable_set("@#{ivar_name}", init_value) end |