Sha256: 343f44a93e8e608e022d0a4a9e51ab01add98288396a4a6c62b18de6b60075a6
Contents?: true
Size: 721 Bytes
Versions: 4
Compression:
Stored size: 721 Bytes
Contents
# -*- encoding: utf-8 -*- module Wasserstand # http://blog.steveklabnik.com/posts/2012-09-09-random-ruby-tricks--class-new IllegalValueError = Class.new(StandardError) class Trend 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 def symbol {:gleichbleibend => '⬄', :steigend => '⬀', :fallend => '⬂', :unbekannt => '?'}[@value] end def to_s @value.to_s end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
wasserstand-0.0.11 | lib/wasserstand/trend.rb |
wasserstand-0.0.10 | lib/wasserstand/trend.rb |
wasserstand-0.0.9 | lib/wasserstand/trend.rb |
wasserstand-0.0.8 | lib/wasserstand/trend.rb |