Sha256: 7293b86467e82fd2c96fa8bff5cc4ce4f41a0ae0364b74b8b3c363ae9b28e224

Contents?: true

Size: 405 Bytes

Versions: 5

Compression:

Stored size: 405 Bytes

Contents

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

    def calculate
      raise "Calculate not implemented"
    end

    private

    attr_reader :context

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

      context
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
prezzo-0.5.1 lib/prezzo/calculator.rb
prezzo-0.5.0 lib/prezzo/calculator.rb
prezzo-0.4.1 lib/prezzo/calculator.rb
prezzo-0.4.0 lib/prezzo/calculator.rb
prezzo-0.3.1 lib/prezzo/calculator.rb