Sha256: 67559fa8cd86c033016ff7432c447e068cf86675f532dda2a2978bcc27f6953e

Contents?: true

Size: 681 Bytes

Versions: 3

Compression:

Stored size: 681 Bytes

Contents

module Wasserstand
  #
  # see http://www.pegelonline.wsv.de/gast/hilfe#hilfe_pegelparameter
  #
  class Level
    class << self
      include Finders

      def all
        Wasserstand.provider.levels
      end
    end

    attr_reader :name
    attr_accessor :level_id, :km, :measurements
    attr_writer :waterway

    def initialize(name)
      @name = name
      @measurements = []
    end

    def waterway
      if @waterway.respond_to?(:name)
        @waterway
      else
        @waterway = Waterway[@waterway]
      end
    end

    def to_s
      name
    end

    def inspect
      "#<#{self.class.name}: #{name} (#{measurements.size} measurements)>"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wasserstand-0.0.11 lib/wasserstand/level.rb
wasserstand-0.0.10 lib/wasserstand/level.rb
wasserstand-0.0.9 lib/wasserstand/level.rb