Class: BaseComposer
- Inherits:
-
Object
- Object
- BaseComposer
- Defined in:
- lib/ViewComposer/base_composer.rb
Class Attribute Summary collapse
-
._attributes ⇒ Object
Returns the value of attribute _attributes.
-
._inherited_methods ⇒ Object
Returns the value of attribute _inherited_methods.
-
._instance_attrs ⇒ Object
Returns the value of attribute _instance_attrs.
-
._instance_defined_methods ⇒ Object
Returns the value of attribute _instance_defined_methods.
-
._model_methods ⇒ Object
Returns the value of attribute _model_methods.
Class Method Summary collapse
Instance Method Summary collapse
- #hash_attrs ⇒ Object
-
#initialize(model:, composable_objects: []) ⇒ BaseComposer
constructor
A new instance of BaseComposer.
- #to_json ⇒ Object
Constructor Details
#initialize(model:, composable_objects: []) ⇒ BaseComposer
Returns a new instance of BaseComposer.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ViewComposer/base_composer.rb', line 23 def initialize(model:, composable_objects: [] ) set_inherited_methods_list @model = model @json_hash = {} set_model_methods set_instance_defined_methods set_attributes_methods setup_comp_objs(composable_objects) methods_to_hash end |
Class Attribute Details
._attributes ⇒ Object
Returns the value of attribute _attributes.
12 13 14 |
# File 'lib/ViewComposer/base_composer.rb', line 12 def _attributes @_attributes end |
._inherited_methods ⇒ Object
Returns the value of attribute _inherited_methods.
12 13 14 |
# File 'lib/ViewComposer/base_composer.rb', line 12 def _inherited_methods @_inherited_methods end |
._instance_attrs ⇒ Object
Returns the value of attribute _instance_attrs.
12 13 14 |
# File 'lib/ViewComposer/base_composer.rb', line 12 def _instance_attrs @_instance_attrs end |
._instance_defined_methods ⇒ Object
Returns the value of attribute _instance_defined_methods.
12 13 14 |
# File 'lib/ViewComposer/base_composer.rb', line 12 def _instance_defined_methods @_instance_defined_methods end |
._model_methods ⇒ Object
Returns the value of attribute _model_methods.
12 13 14 |
# File 'lib/ViewComposer/base_composer.rb', line 12 def _model_methods @_model_methods end |
Class Method Details
.attributes(*attrs) ⇒ Object
34 35 36 37 |
# File 'lib/ViewComposer/base_composer.rb', line 34 def self.attributes(*attrs) self._instance_attrs = attrs Array(attrs).each {|attr| self._attributes << attr} end |
.inherited(base) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/ViewComposer/base_composer.rb', line 39 def self.inherited(base) super base._attributes = self._attributes.dup base._inherited_methods = self._inherited_methods.dup base._model_methods = self._model_methods.dup end |
Instance Method Details
#hash_attrs ⇒ Object
46 47 48 |
# File 'lib/ViewComposer/base_composer.rb', line 46 def hash_attrs @json_hash end |
#to_json ⇒ Object
50 51 52 |
# File 'lib/ViewComposer/base_composer.rb', line 50 def to_json @json_hash.to_json end |