Class: NumbersAndWords::Wrappers::Float

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(number) ⇒ Float

Returns a new instance of Float.



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

def initialize number
  @number = number
end

Instance Attribute Details

#numberObject

Returns the value of attribute number.



4
5
6
# File 'lib/numbers_and_words/wrappers/float.rb', line 4

def number
  @number
end

Instance Method Details

#to_words(options = {}) ⇒ Object



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

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