Sha256: e8e556b5bf108d1b5cef5a6b73a51767fe50a7da3eb16abb7bcacfacc76660f4

Contents?: true

Size: 462 Bytes

Versions: 3

Compression:

Stored size: 462 Bytes

Contents

module Id
  module Model
    class Definer

      def self.method_memoize(context, name, &value_block)
        method(context, name) do |object|
          object.instance_eval do
            memoize(name, &value_block)
          end
        end
      end

      def self.method(context, name, &value_block)
        context.instance_eval do
          define_method name do
            value_block.call(self)
          end
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
id-0.0.12 lib/id/model/definer.rb
id-0.0.11 lib/id/model/definer.rb
id-0.0.10 lib/id/model/definer.rb