Module: Neo4j::Shared::TypecastedAttributes
- Extended by:
- ActiveSupport::Concern
- Includes:
- Attributes
- Included in:
- Property
- Defined in:
- lib/neo4j/shared/typecasted_attributes.rb
Overview
TypecastedAttributes allows types to be declared for your attributes
Types are declared by passing the :type option to the attribute class method. After a type is declared, attribute readers will convert any assigned attribute value to the declared type. If the assigned value cannot be cast, nil will be returned instead. You can access the original assigned value using the before_type_cast methods.
See Typecasting for the currently supported types.
Originally part of ActiveAttr, github.com/cgriego/active_attr
Defined Under Namespace
Modules: ClassMethods
Constant Summary
Constants included from Attributes
Attributes::DEPRECATED_OBJECT_METHODS
Instance Method Summary collapse
-
#attribute_before_type_cast(name) ⇒ Object?
Read the raw attribute value.
Methods included from Attributes
#==, #attributes, #query_attribute, #write_attribute
Instance Method Details
#attribute_before_type_cast(name) ⇒ Object?
Read the raw attribute value
41 42 43 44 |
# File 'lib/neo4j/shared/typecasted_attributes.rb', line 41 def attribute_before_type_cast(name) @attributes ||= {} @attributes[name.to_s] end |