Class: Bors::Example::Feature

Inherits:
Object
  • Object
show all
Includes:
Math
Defined in:
lib/bors/example/feature.rb

Instance Method Summary collapse

Methods included from Math

#is_number?, #is_real_number?

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_sObject



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