Class: Wasserstand::Trend

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

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Trend

Returns a new instance of Trend.

Raises:



7
8
9
10
11
12
13
14
# File 'lib/wasserstand/trend.rb', line 7

def initialize(value)
  @value = {'gleich'    => :gleichbleibend,
            'steigend'  => :steigend,
            'fallend'   => :fallend,
            'unbekannt' => :unbekannt}[UnicodeUtils.downcase(value.to_s)]

  raise IllegalValueError, "Unknown trend #{value.inspect}" unless @value
end

Instance Method Details

#symbolObject



16
17
18
19
20
21
# File 'lib/wasserstand/trend.rb', line 16

def symbol
  {:gleichbleibend => '',
   :steigend       => '',
   :fallend        => '',
   :unbekannt      => '?'}[@value]
end

#to_sObject



23
24
25
# File 'lib/wasserstand/trend.rb', line 23

def to_s
  @value.to_s
end