Sha256: 6931220479dade99258dce2cf259c4d11a540a81738077b135ad81e4c4202b2e

Contents?: true

Size: 677 Bytes

Versions: 3

Compression:

Stored size: 677 Bytes

Contents

require 'bigdecimal'
require 'active_support/core_ext/enumerable'
module SK
  # calculation module
  # == Usage
  #
  #   class LineItem
  #     calculates :item
  #   end
  #
  #   class Invoice
  #     calculates :items
  #   end
  module Calc

    def self.included(base)
      autoload :Helper, 'sk_calc/helper'
      autoload :Item, 'sk_calc/item'
      autoload :Items, 'sk_calc/items'
      base.extend(ClassMethods)
  #    base.send(:include, InstanceMethods)
    end

    module ClassMethods

      def calculates(kind, opts={})
        include Item if kind == :item
        include Items if kind == :items
      end
    end

    module InstanceMethods; end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sk_calc-0.0.6 lib/sk_calc.rb
sk_calc-0.0.5 lib/sk_calc.rb
sk_calc-0.0.4 lib/sk_calc.rb