class Zone

Public Class Methods

new(attributes) click to toggle source
# File lib/skiplan_client/zone.rb, line 7
def initialize(attributes)
  normalized_attrs = attributes.dup
  normalized_attrs['REMONTEE'] = [normalized_attrs['REMONTEE']] if normalized_attrs['REMONTEE'].is_a?(Hash)
  normalized_attrs['PISTE'] = [normalized_attrs['PISTE']] if normalized_attrs['PISTE'].is_a?(Hash)
  normalized_attrs['Liaison'] = [normalized_attrs['Liaison']] if normalized_attrs['Liaison'].is_a?(Hash)
  self.attributes = normalized_attrs
end

Public Instance Methods

connections() click to toggle source
# File lib/skiplan_client/zone.rb, line 27
def connections
  @Liaison
end
name() click to toggle source
# File lib/skiplan_client/zone.rb, line 15
def name
  @nom
end
ratio(array_field = []) click to toggle source
# File lib/skiplan_client/zone.rb, line 31
def ratio(array_field = [])
  open_entries = array_field.select {|r| r['etat'] == 'O'}
  "#{open_entries.length}/#{array_field.length}"
end
skilifts() click to toggle source
# File lib/skiplan_client/zone.rb, line 19
def skilifts
  @REMONTEE
end
slopes() click to toggle source
# File lib/skiplan_client/zone.rb, line 23
def slopes
  @PISTE
end