Class: Wasserstand::Trend
- Inherits:
-
Object
- Object
- Wasserstand::Trend
- Defined in:
- lib/wasserstand/trend.rb
Instance Method Summary collapse
-
#initialize(value) ⇒ Trend
constructor
A new instance of Trend.
- #symbol ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(value) ⇒ Trend
Returns a new instance of Trend.
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
#symbol ⇒ Object
16 17 18 19 20 21 |
# File 'lib/wasserstand/trend.rb', line 16 def symbol {:gleichbleibend => '⬄', :steigend => '⬀', :fallend => '⬂', :unbekannt => '?'}[@value] end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/wasserstand/trend.rb', line 23 def to_s @value.to_s end |