Sha256: 922203119651cd2964bee11bd87ce25967599ef9e19df75f4113a4dd4c3f1850

Contents?: true

Size: 706 Bytes

Versions: 1

Compression:

Stored size: 706 Bytes

Contents

module CashFlowAnalysis
  module Util
    class ObjectiveFunction
      def eps
        BigDecimal.new("1.0e-16")
      end

      def zero
        BigDecimal.new("0.0")
      end

      def one
        BigDecimal.new("1.0")
      end

      def two
        BigDecimal.new("2.0")
      end

      def ten
        BigDecimal.new("10.0")
      end

      def initialize(calculator, cash_flow_items)
        @calculator = calculator
        @cash_flow_items = cash_flow_items
      end

      def values(discount_rates)
        [calculator.calculate(discount_rates.first.round(15), cash_flow_items)]
      end

      private

      attr_reader :calculator
      attr_reader :cash_flow_items
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cash_flow_analysis-0.1.0 lib/cash_flow_analysis/util/objective_function.rb