Class: XmlDsl::InstanceWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/xml_dsl/block_method.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(instance) ⇒ InstanceWrapper

Returns a new instance of InstanceWrapper.



62
63
64
# File 'lib/xml_dsl/block_method.rb', line 62

def initialize(instance)
  self.instance = instance
end

Instance Attribute Details

#instanceObject

Returns the value of attribute instance.



60
61
62
# File 'lib/xml_dsl/block_method.rb', line 60

def instance
  @instance
end

Instance Method Details

#set(key, value) ⇒ Object



66
67
68
69
70
71
72
# File 'lib/xml_dsl/block_method.rb', line 66

def set(key, value)
  if instance.is_a? Hash
    instance[key] = value
  else
    instance.send "#{key}=", value
  end
end