Sha256: 19a7b316e181a74fd691f26b67b1388f0acdb63a7fbb0e9bc925097f817b391e

Contents?: true

Size: 398 Bytes

Versions: 1

Compression:

Stored size: 398 Bytes

Contents

module Prezzo
  module Explainable
    def self.included(base)
      base.class_eval do
        base.extend(ClassMethods)
      end
    end

    module ClassMethods
      def explain_with(*options)
        define_method(:explain) do
          options.each_with_object({}) do |method, explanation|
            explanation[method] = send(method)
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
prezzo-0.3.1 lib/prezzo/explainable.rb