Class: RademadeAdmin::Model::Reflection
- Inherits:
-
Object
- Object
- RademadeAdmin::Model::Reflection
- Defined in:
- lib/rademade_admin/model/reflection.rb
Constant Summary collapse
- ORM_TYPE_ACTIVERECORD =
'ActiveRecord'
- ORM_TYPE_MONGOID =
'Mongoid'
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#module_name ⇒ Object
readonly
Returns the value of attribute module_name.
Instance Method Summary collapse
-
#data_adapter ⇒ RademadeAdmin::Model::Adapter::Data
Load data adapter for current model.
- #hideable? ⇒ Boolean
-
#initialize(model, controller, module_name) ⇒ Reflection
constructor
A new instance of Reflection.
-
#query_adapter ⇒ RademadeAdmin::Model::Adapter::Query
Load query adapter for current model.
Constructor Details
#initialize(model, controller, module_name) ⇒ Reflection
Returns a new instance of Reflection.
11 12 13 |
# File 'lib/rademade_admin/model/reflection.rb', line 11 def initialize(model, controller, module_name) @model, @controller, @module_name = model, controller, module_name end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
9 10 11 |
# File 'lib/rademade_admin/model/reflection.rb', line 9 def controller @controller end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
9 10 11 |
# File 'lib/rademade_admin/model/reflection.rb', line 9 def model @model end |
#module_name ⇒ Object (readonly)
Returns the value of attribute module_name.
9 10 11 |
# File 'lib/rademade_admin/model/reflection.rb', line 9 def module_name @module_name end |
Instance Method Details
#data_adapter ⇒ RademadeAdmin::Model::Adapter::Data
Load data adapter for current model
18 19 20 |
# File 'lib/rademade_admin/model/reflection.rb', line 18 def data_adapter @data_adapter ||= "RademadeAdmin::Model::Adapter::Data::#{orm_type}".constantize.new(@model) end |
#hideable? ⇒ Boolean
29 30 31 |
# File 'lib/rademade_admin/model/reflection.rb', line 29 def hideable? _model_ancestors.include? RademadeAdmin::Hideable.name end |
#query_adapter ⇒ RademadeAdmin::Model::Adapter::Query
Load query adapter for current model
25 26 27 |
# File 'lib/rademade_admin/model/reflection.rb', line 25 def query_adapter @query_adapter ||= "RademadeAdmin::Model::Adapter::Query::#{orm_type}".constantize.new(@model) end |