Class: Fixnum

Inherits:
Object show all
Defined in:
lib/extensions/fixnum.rb

Instance Method Summary collapse

Instance Method Details

#to_boolObject



19
20
21
# File 'lib/extensions/fixnum.rb', line 19

def to_bool
  0 != self && nil != self  ? true : false  
end

#to_englishObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/extensions/fixnum.rb', line 2

def to_english
  case self
    when 0 then "zero"
    when 1 then "one"
    when 2 then "two"
    when 3 then "three"
    when 4 then "four"
    when 5 then "five"
    when 6 then "six"
    when 7 then "seven"
    when 8 then "eight"
    when 9 then "nine"
    when 10 then "ten"
    else raise "to_english has not been implemented to convert #{self}"      
  end
end