Class: NumbersAndWords::Wrappers::Float

Inherits:
Object
  • Object
show all
Defined in:
lib/numbers_and_words/wrappers/float.rb

Constant Summary collapse

ZERO_SYMBOL =
'0'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(number) ⇒ Float

Returns a new instance of Float.



10
11
12
# File 'lib/numbers_and_words/wrappers/float.rb', line 10

def initialize(number)
  @number = number
end

Instance Attribute Details

#numberObject

Returns the value of attribute number.



8
9
10
# File 'lib/numbers_and_words/wrappers/float.rb', line 8

def number
  @number
end

Instance Method Details

#to_words(options = {}) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/numbers_and_words/wrappers/float.rb', line 14

def to_words(options = {})
  @options = options
  words = []
  words << integral_part_with(options)
  words << fractional_part_with(options) unless fractional_part_is_nil?
  NumbersAndWords::WordsArray.new(words).join options
end