Sha256: bc8eaf76cfa3c636f9ee8bcde57659cb299609052602141a1d232d215fda2454

Contents?: true

Size: 419 Bytes

Versions: 4

Compression:

Stored size: 419 Bytes

Contents

module Prezzo
  module Calculator
    def initialize(context = {})
      @context = validated!(context)
    end

    def calculate
      raise "Calculate not implemented"
    end

    private

    def validated!(context)
      raise "Empty Context" if context.nil?
      raise "Invalid Context" if context.respond_to?(:valid?) && !context.valid?

      context
    end

    def context
      @context
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
prezzo-0.3.0 lib/prezzo/calculator.rb
prezzo-0.2.2 lib/prezzo/calculator.rb
prezzo-0.2.1 lib/prezzo/calculator.rb
prezzo-0.2.0 lib/prezzo/calculator.rb