lib/prezzo/context.rb in prezzo-0.2.0 vs lib/prezzo/context.rb in prezzo-0.2.1
- old
+ new
@@ -14,11 +14,18 @@
def errors
validation.errors
end
- def fetch(*args)
- attributes.fetch(*args)
+ def fetch(key, default = nil)
+ if default.nil?
+ value = attributes.fetch(key)
+ else
+ value = attributes.fetch(key, default)
+ value = default if value.nil?
+ end
+
+ value
end
def attributes
validation.output
end