lib/structural/model/definer.rb in structural-0.0.3 vs lib/structural/model/definer.rb in structural-0.1.0
- old
+ new
@@ -1,18 +1,18 @@
module Structural
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)
+ 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.instance_eval do
- define_method name do
+ context.class_eval do
+ define_method(name) do
value_block.call(self)
end
end
end
end