module Hashme::Attributes

Public Instance Methods

[](key) click to toggle source
# File lib/hashme/attributes.rb, line 17
def [](key)
  _attributes[key.to_sym]
end
[]=(key, value) click to toggle source
# File lib/hashme/attributes.rb, line 13
def []=(key, value)
  _attributes[key.to_sym] = value
end
clone() click to toggle source
Calls superclass method
# File lib/hashme/attributes.rb, line 35
def clone
  new = super
  @_attributes = @_attributes.clone
  new
end
delete(key) click to toggle source
# File lib/hashme/attributes.rb, line 25
def delete(key)
  _attributes.delete(key.to_sym)
end
dup() click to toggle source
Calls superclass method
# File lib/hashme/attributes.rb, line 29
def dup
  new = super
  @_attributes = @_attributes.dup
  new
end
has_key?(key) click to toggle source
# File lib/hashme/attributes.rb, line 21
def has_key?(key)
  _attributes.has_key?(key.to_sym)
end
inspect() click to toggle source
# File lib/hashme/attributes.rb, line 41
def inspect
  string = keys.collect{|key|
    "#{key}: #{self[key].inspect}"
  }.compact.join(", ")
  "#<#{self.class} #{string}>"
end

Private Instance Methods

_attributes() click to toggle source
# File lib/hashme/attributes.rb, line 50
def _attributes
  @_attributes ||= {}
  @_attributes
end