Class: Percentage

Inherits:
Object show all
Defined in:
lib/glimr/util.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Percentage

Returns a new instance of Percentage.



12
13
14
# File 'lib/glimr/util.rb', line 12

def initialize(value)
  @value = value
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object



20
21
22
23
24
# File 'lib/glimr/util.rb', line 20

def method_missing(*args, &block)
  to_f.__send__(*args, &block)
rescue => e
  raise e
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



10
11
12
# File 'lib/glimr/util.rb', line 10

def value
  @value
end

Instance Method Details

#to_fObject



16
17
18
# File 'lib/glimr/util.rb', line 16

def to_f
  value / 100.0
end