Class: Tyt::SkiDay

Inherits:
Hashie::Dash
  • Object
show all
Defined in:
lib/tyt/ski_day.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ SkiDay

Returns a new instance of SkiDay.



8
9
10
11
12
13
# File 'lib/tyt/ski_day.rb', line 8

def initialize(hash = {})
  hash[:vertical_feet] = string_to_i(hash[:vertical_feet])
  hash[:runs] = string_to_i(hash[:runs])
  hash[:vertical_meters] = string_to_i(hash[:vertical_meters])
  super
end

Instance Method Details

#string_to_i(str) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/tyt/ski_day.rb', line 15

def string_to_i(str)
  if str
    str = str.gsub(',','')
    return str.to_i
  else
    return nil
  end
end