Class: NumbersAndWords::Wrappers::Float

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

Constant Summary collapse

ZERO_SYMBOL =
'0'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(number) ⇒ Float

Returns a new instance of Float.



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

def initialize(number)
  @number = number
end

Instance Attribute Details

#numberObject

Returns the value of attribute number.



6
7
8
# File 'lib/numbers_and_words/wrappers/float.rb', line 6

def number
  @number
end

Instance Method Details

#to_words(options = {}) ⇒ Object



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

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