lib/axiom/attribute.rb in axiom-0.1.1 vs lib/axiom/attribute.rb in axiom-0.2.0

- old
+ new

@@ -33,14 +33,15 @@ # # @api private def self.coerce(object) if object.kind_of?(Attribute) object + elsif equal?(Attribute) + Object.coerce(object) else name, type, options = object - klass = equal?(Attribute) ? Object : self - klass = const_get(type.name) if type + klass = type ? const_get(type.name) : self klass.new(name, options || EMPTY_HASH) end end # Extract the attribute name from the object @@ -102,11 +103,11 @@ # # @return [Object] # # @api public def call(tuple) - tuple.call(self) + tuple[self] end # Rename an attribute # # @example @@ -147,10 +148,10 @@ # # @return [Boolean] # # @api public def optional? - ! required? + !required? end # Test if the value matches the attribute constraints # # @example