Module: Her::Model
- Extended by:
- ActiveSupport::Concern
- Includes:
- Introspection, ORM, Paths, Relationships
- Included in:
- Base
- Defined in:
- lib/her/model.rb,
lib/her/model/orm.rb,
lib/her/model/base.rb,
lib/her/model/http.rb,
lib/her/model/hooks.rb,
lib/her/model/paths.rb,
lib/her/model/introspection.rb,
lib/her/model/relationships.rb,
lib/her/model/orm/find_methods.rb,
lib/her/model/orm/save_methods.rb,
lib/her/model/orm/error_methods.rb,
lib/her/model/orm/create_methods.rb,
lib/her/model/orm/update_methods.rb,
lib/her/model/orm/destroy_methods.rb,
lib/her/model/orm/relation_mapper.rb,
lib/her/model/orm/fields_definition.rb,
lib/her/model/orm/comparison_methods.rb,
lib/her/model/orm/persistance_methods.rb,
lib/her/model/orm/serialization_methods.rb
Overview
This module is the main element of Her. After creating a Her::API object, include this module in your models to get a few magic methods defined in them.
Defined Under Namespace
Modules: Base, HTTP, Hooks, Introspection, ORM, Paths, Relationships
Instance Attribute Summary
Attributes included from ORM
Instance Method Summary collapse
-
#[](attribute_name) ⇒ Object
Returns * the value of the attribute_nane attribute if it’s in orm data * the resource/collection corrsponding to attribute_name if it’s a relationship.
-
#has_key?(attribute_name) ⇒ Boolean
Returns true if attribute_name is * in orm data * a relationship.
Methods included from Relationships
#get_relationship, #has_relationship?
Methods included from Paths
Methods included from Introspection
Methods included from ORM
#assign_data, #convert_types, #get_data, #has_data?, #id, #initialize, initialize_collection, #method_missing, #respond_to?, use_setter_methods
Methods included from ORM::SerializationMethods
Methods included from ORM::PersistanceMethods
#destroyed?, #new?, #persisted?
Methods included from ORM::ComparisonMethods
Methods included from ORM::ErrorMethods
Methods included from ORM::UpdateMethods
#update_attribute, #update_attributes, #update_attributes!
Methods included from ORM::SaveMethods
#create_or_update, #save, #save!
Methods included from ORM::DestroyMethods
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Her::Model::ORM
Instance Method Details
#[](attribute_name) ⇒ Object
Returns
-
the value of the attribute_nane attribute if it’s in orm data
-
the resource/collection corrsponding to attribute_name if it’s a relationship
64 65 66 67 |
# File 'lib/her/model.rb', line 64 def [](attribute_name) get_data(attribute_name) || get_relationship(attribute_name) end |
#has_key?(attribute_name) ⇒ Boolean
Returns true if attribute_name is
-
in orm data
-
a relationship
56 57 58 59 |
# File 'lib/her/model.rb', line 56 def has_key?(attribute_name) has_data?(attribute_name) || has_relationship?(attribute_name) end |