Method: Collins::PowerUnit#initialize

Defined in:
lib/collins/power.rb

#initialize(model = {}) ⇒ PowerUnit

Returns a new instance of PowerUnit.



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/collins/power.rb', line 12

def initialize model = {}
  hash = symbolize_hash(model).inject({}) do |result, (k,v)|
    result[k.downcase] = v
    result
  end
  @key = hash[:key].to_s
  @value = hash[:value].to_s
  @type = hash[:type].to_s
  @label = hash[:label].to_s
  @position = hash[:position].to_s.to_i
  @is_required = hash[:is_required]
  @unique = hash[:unique]
end