Class: AttrTypecastable::Reflection
- Inherits:
-
Object
- Object
- AttrTypecastable::Reflection
- Defined in:
- lib/attr_typecastable/reflection.rb
Instance Attribute Summary collapse
-
#attribute_name ⇒ Object
readonly
Returns the value of attribute attribute_name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#typecaster ⇒ Object
readonly
Returns the value of attribute typecaster.
Instance Method Summary collapse
- #default ⇒ Object
- #has_default? ⇒ Boolean
-
#initialize(attribute_name, typecaster, **options) ⇒ Reflection
constructor
A new instance of Reflection.
Constructor Details
#initialize(attribute_name, typecaster, **options) ⇒ Reflection
Returns a new instance of Reflection.
5 6 7 8 9 10 |
# File 'lib/attr_typecastable/reflection.rb', line 5 def initialize(attribute_name, typecaster, **) @attribute_name = attribute_name @typecaster = typecaster @options = freeze end |
Instance Attribute Details
#attribute_name ⇒ Object (readonly)
Returns the value of attribute attribute_name.
3 4 5 |
# File 'lib/attr_typecastable/reflection.rb', line 3 def attribute_name @attribute_name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/attr_typecastable/reflection.rb', line 3 def @options end |
#typecaster ⇒ Object (readonly)
Returns the value of attribute typecaster.
3 4 5 |
# File 'lib/attr_typecastable/reflection.rb', line 3 def typecaster @typecaster end |
Instance Method Details
#default ⇒ Object
12 13 14 |
# File 'lib/attr_typecastable/reflection.rb', line 12 def default @options[:default] end |
#has_default? ⇒ Boolean
16 17 18 |
# File 'lib/attr_typecastable/reflection.rb', line 16 def has_default? @options.key?(:default) end |