Sha256: 591f01c3d9632d981b72ff47efe7c784cf6faa27f58504612ee337efab868947

Contents?: true

Size: 400 Bytes

Versions: 1

Compression:

Stored size: 400 Bytes

Contents

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

    module ClassMethods
      def composed_by(options)
        options.each do |name, klass|
          options[name] = klass

          define_method(name) do
            options[name].new(context).calculate
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
prezzo-0.2.2 lib/prezzo/composed.rb