Class: Numeric

Inherits:
Object
  • Object
show all
Defined in:
lib/dot_number.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/dot_number.rb', line 18

def method_missing(method_name, *args)
    name = method_name.to_s
    if name.end_with? "?" then
        begin
            numeric_value = text_to_number(name[..-2])
            return self == numeric_value
        rescue ArgumentError
            raise NoMethodError.new()
        end
    else
        raise NoMethodError.new()
    end
end