Class: Finance::Cashflow::Function Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Base class for working with Newton’s Method.

Instance Method Summary collapse

Constructor Details

#initialize(transactions, function) ⇒ Function

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Function.



29
30
31
32
# File 'lib/finance/cashflows.rb', line 29

def initialize(transactions, function)
  @transactions = transactions
  @function = function
end

Instance Method Details

#values(x) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



34
35
36
37
# File 'lib/finance/cashflows.rb', line 34

def values(x)
  value = @transactions.send(@function, Flt::DecNum.new(x[0].to_s))
  [ BigDecimal.new(value.to_s) ]
end