Class: Bors::Example::Feature
- Inherits:
-
Object
- Object
- Bors::Example::Feature
- Includes:
- Math
- Defined in:
- lib/bors/example/feature.rb
Instance Method Summary collapse
-
#initialize(value) ⇒ Feature
constructor
A new instance of Feature.
- #to_s ⇒ Object
Methods included from Math
Constructor Details
#initialize(value) ⇒ Feature
Returns a new instance of Feature.
9 10 11 |
# File 'lib/bors/example/feature.rb', line 9 def initialize(value) @value = value end |
Instance Method Details
#to_s ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/bors/example/feature.rb', line 13 def to_s returning = "" if @value.kind_of?(String) returning += @value else @value.each do |key, value| raise Exceptions::NotRealNumber.new unless is_real_number?(value) if key.to_s.match(/\s/) key.split(/\s/).each do |word| returning += "#{word}:#{value} " end else returning += "#{key}:#{value} " end end end returning.strip end |