Sha256: 6ab2cf8381493c240e76be54e2d8b273bc686a588c3eb553c5ff7a2761609a6a

Contents?: true

Size: 680 Bytes

Versions: 3

Compression:

Stored size: 680 Bytes

Contents

require 'skiplan_client/attribute_helper'

class Zone

  include AttributeHelper

  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)
    self.attributes = normalized_attrs
  end

  def name
    @nom
  end

  def skilifts
    @REMONTEE
  end

  def slopes
    @PISTE
  end

  def ratio(array_field = [])
    open_entries = array_field.select {|r| r['etat'] == 'O'}
    "#{open_entries.length}/#{array_field.length}"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
skiplan_client-0.2.2 lib/skiplan_client/zone.rb
skiplan_client-0.2.1 lib/skiplan_client/zone.rb
skiplan_client-0.2.0 lib/skiplan_client/zone.rb