Sha256: 3b8580a69c777a746a1243bde1cd44d8c40cb7ad304c58ec79898d518610687a

Contents?: true

Size: 469 Bytes

Versions: 2

Compression:

Stored size: 469 Bytes

Contents

module Structural
  module Model
    class Definer
      def self.method_memoize(context, name, ivar_name, &value_block)
        context.class_eval do
          define_method(name) do
            memoize(ivar_name, &value_block)
          end
        end
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
structural-0.2.0 lib/structural/model/definer.rb
structural-0.1.0 lib/structural/model/definer.rb