Module: Mingo::Properties
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #[](field, &block) ⇒ Object
- #[]=(field, value) ⇒ Object
- #inspect ⇒ Object
- #stringify_keys ⇒ Object
-
#stringify_keys! ⇒ Object
keys are already strings.
- #to_hash ⇒ Object
Instance Method Details
#[](field, &block) ⇒ Object
50 51 52 |
# File 'lib/mingo/properties.rb', line 50 def [](field, &block) super(field.to_s, &block) end |
#[]=(field, value) ⇒ Object
54 55 56 |
# File 'lib/mingo/properties.rb', line 54 def []=(field, value) super(field.to_s, value) end |
#inspect ⇒ Object
44 45 46 47 48 |
# File 'lib/mingo/properties.rb', line 44 def inspect str = "<##{self.class.to_s}" str << self.class.properties.map { |p| " #{p}=#{self.send(p).inspect}" }.join('') str << '>' end |
#stringify_keys ⇒ Object
64 |
# File 'lib/mingo/properties.rb', line 64 def stringify_keys() stringify_keys!.dup end |
#stringify_keys! ⇒ Object
keys are already strings
63 |
# File 'lib/mingo/properties.rb', line 63 def stringify_keys!() self end |
#to_hash ⇒ Object
58 59 60 |
# File 'lib/mingo/properties.rb', line 58 def to_hash Hash.new.replace(self) end |