Class: Jamef::Elegible

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::NumberHelper
Defined in:
lib/jamef/elegible.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operator, *args) ⇒ Elegible

Returns a new instance of Elegible.



6
7
8
9
# File 'lib/jamef/elegible.rb', line 6

def initialize(operator, *args)
  args = args.shift if args[0].kind_of?(Array)
  @total = args.inject(operator)
end

Instance Attribute Details

#totalObject (readonly)

Returns the value of attribute total.



4
5
6
# File 'lib/jamef/elegible.rb', line 4

def total
  @total
end

Instance Method Details

#to_sObject



11
12
13
# File 'lib/jamef/elegible.rb', line 11

def to_s
  number_to_currency(@total, separator: ",", delimiter: "", format: "%n")
end