lib/mattock/configurable.rb in mattock-0.1.1 vs lib/mattock/configurable.rb in mattock-0.1.2
- old
+ new
@@ -109,10 +109,11 @@
end
extend ClassMethods
def copy_settings_to(other)
self.class.copy_settings(self, other)
+ self
end
def setup_defaults
self.class.set_defaults_on(self)
self
@@ -122,9 +123,13 @@
missing = self.class.missing_required_fields_on(self)
unless missing.empty?
raise "Required field#{missing.length > 1 ? "s" : ""} #{missing.map{|field| field.to_s.inspect}.join(", ")} unset on #{self.inspect}"
end
self
+ end
+
+ def unset?(value)
+ value == RequiredField
end
def setting(name, default_value = nil)
self.class.setting(name, default_value)
instance_variable_set("@#{name}", default_value)