structure.rb in structure-0.27.4 vs structure.rb in structure-0.27.5
- old
+ new
@@ -49,10 +49,18 @@
def inherited(subclass)
subclass.instance_variable_set(:@attribute_names, @attribute_names.dup)
end
def attribute(name, &blk)
- define_method(name, &blk)
+ define_method("_#{name}", blk)
+ private "_#{name}"
+
+ module_eval <<-END
+ def #{name}
+ @#{name} ||= _#{name}
+ end
+ END
+
@attribute_names << name
end
end
end