From a66cab3ea4180f7e0845cbf376d1485affaeea6f Mon Sep 17 00:00:00 2001 From: Nick Giancola Date: Sun, 24 Jul 2016 12:42:33 -0700 Subject: [PATCH] Document available options for `.attribute` --- lib/active_attr/attribute_definition.rb | 4 ++++ lib/active_attr/attributes.rb | 2 ++ 2 files changed, 6 insertions(+) diff --git a/lib/active_attr/attribute_definition.rb b/lib/active_attr/attribute_definition.rb index e96ac49..8d0582c 100644 --- a/lib/active_attr/attribute_definition.rb +++ b/lib/active_attr/attribute_definition.rb @@ -48,6 +48,10 @@ def [](key) # # @param [Symbol, String, #to_sym] name attribute name # @param [Hash{Symbol => Object}] options attribute options + # @option options [Object] :default default value + # @option options [Object] :type type to coerce the value to + # @option options [Object] :typecaster object responding to `#call(value)` + # that returns the coerced value # # @return [ActiveAttr::AttributeDefinition] # diff --git a/lib/active_attr/attributes.rb b/lib/active_attr/attributes.rb index 0c13c9e..60e4a11 100644 --- a/lib/active_attr/attributes.rb +++ b/lib/active_attr/attributes.rb @@ -165,6 +165,7 @@ module ClassMethods # attribute :name # # @param (see AttributeDefinition#initialize) + # @option (see AttributeDefinition#initialize) # # @raise [DangerousAttributeError] if the attribute name conflicts with # existing methods @@ -192,6 +193,7 @@ def attribute(name, options={}) # attribute! :timeout # # @param (see AttributeDefinition#initialize) + # @option (see AttributeDefinition#initialize) # # @return [AttributeDefinition] Attribute's definition #