lib/rasti/db/model.rb in rasti-db-0.2.7 vs lib/rasti/db/model.rb in rasti-db-0.2.8

- old
+ new

@@ -46,11 +46,11 @@ raise ArgumentError, "Attribute #{name} already exists" if attributes.include?(name) attributes << name define_method name do - attributes.key?(name) ? attributes[name] : raise(UninitializedAttributeError, name) + fetch_attribute name end end end end @@ -97,9 +97,13 @@ end private attr_reader :attributes + + def fetch_attribute(name) + attributes.key?(name) ? attributes[name] : raise(UninitializedAttributeError, name) + end end end end \ No newline at end of file