Class: Wasserstand::Level

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

Overview

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Level

Returns a new instance of Level.



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

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

Instance Attribute Details

#kmObject

Returns the value of attribute km.



27
28
29
# File 'lib/wasserstand/level.rb', line 27

def km
  @km
end

#level_idObject

Returns the value of attribute level_id.



27
28
29
# File 'lib/wasserstand/level.rb', line 27

def level_id
  @level_id
end

#measurementsObject

Returns the value of attribute measurements.



27
28
29
# File 'lib/wasserstand/level.rb', line 27

def measurements
  @measurements
end

#nameObject (readonly)

Returns the value of attribute name.



26
27
28
# File 'lib/wasserstand/level.rb', line 26

def name
  @name
end

#waterwayObject



35
36
37
38
39
40
41
# File 'lib/wasserstand/level.rb', line 35

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

Class Method Details

.[](name) ⇒ Object



7
8
9
# File 'lib/wasserstand/level.rb', line 7

def [](name)
  provider[name]
end

.allObject



11
12
13
# File 'lib/wasserstand/level.rb', line 11

def all
  provider.all
end

.find_by_name(regex) ⇒ Object



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

def find_by_name(regex)
  provider.find_by_name(regex)
end

Instance Method Details

#to_sObject



43
44
45
# File 'lib/wasserstand/level.rb', line 43

def to_s
  name
end