Module: Windcharger::HashTransformer

Defined in:
lib/windcharger/hash_transformer.rb

Instance Method Summary collapse

Instance Method Details

#to_h(*args, &block) ⇒ Object



11
12
13
# File 'lib/windcharger/hash_transformer.rb', line 11

def to_h(*args, &block)
  transform(*args, &block)
end

#transformObject



5
6
7
8
9
# File 'lib/windcharger/hash_transformer.rb', line 5

def transform
  self.class.attributes.each_with_object({}) do |attribute, hash|
    hash[attribute] = public_send(attribute)
  end.freeze
end