Class: Financial::Revenues

Inherits:
Array
  • Object
show all
Defined in:
lib/financial/revenues.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &blk) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/financial/revenues.rb', line 3

def method_missing(meth, *args, &blk)
  unless args.empty?
    revenue = Revenue.new(meth, args)
    self.push(revenue)
    revenue
  else
    raise RevenueWithoutValue, "Revenue: #{meth} don't have a value. Pass a value!"
  end
end