Class: Trundle::NamespacedAttributes

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/trundle/namespaced_attributes.rb

Instance Method Summary collapse

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_hObject



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