Class: Wasserstand::Level

Inherits:
Object
  • Object
show all
Extended by:
Finders
Defined in:
lib/wasserstand/level.rb

Overview

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Finders

[]

Constructor Details

#initialize(name) ⇒ Level

Returns a new instance of Level.



18
19
20
21
# File 'lib/wasserstand/level.rb', line 18

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

Instance Attribute Details

#kmObject

Returns the value of attribute km.



15
16
17
# File 'lib/wasserstand/level.rb', line 15

def km
  @km
end

#level_idObject

Returns the value of attribute level_id.



15
16
17
# File 'lib/wasserstand/level.rb', line 15

def level_id
  @level_id
end

#measurementsObject

Returns the value of attribute measurements.



15
16
17
# File 'lib/wasserstand/level.rb', line 15

def measurements
  @measurements
end

#nameObject (readonly)

Returns the value of attribute name.



14
15
16
# File 'lib/wasserstand/level.rb', line 14

def name
  @name
end

#waterwayObject



23
24
25
26
27
28
29
# File 'lib/wasserstand/level.rb', line 23

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

Class Method Details

.allObject



9
10
11
# File 'lib/wasserstand/level.rb', line 9

def all
  Wasserstand.provider.levels
end

Instance Method Details

#inspectObject



35
36
37
# File 'lib/wasserstand/level.rb', line 35

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

#to_sObject



31
32
33
# File 'lib/wasserstand/level.rb', line 31

def to_s
  name
end