Class: Trundle::NamespacedAttributes
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Trundle::NamespacedAttributes
- Defined in:
- lib/trundle/namespaced_attributes.rb
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ NamespacedAttributes
constructor
A new instance of NamespacedAttributes.
- #to_h ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ NamespacedAttributes
Returns a new instance of NamespacedAttributes.
2 3 4 |
# File 'lib/trundle/namespaced_attributes.rb', line 2 def initialize(attributes = {}) super(normalize_attributes(attributes)) end |
Instance Method Details
#to_h ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/trundle/namespaced_attributes.rb', line 6 def to_h attrs = {} super.to_h.each do |key, value| attrs[Trundle::Key.new(key).camelize] = value end attrs end |