Class: AssociateJsonb::ArelNodes::Jsonb::Attribute
- Inherits:
-
Object
- Object
- AssociateJsonb::ArelNodes::Jsonb::Attribute
- Defined in:
- lib/associate_jsonb/arel_nodes/jsonb/attribute.rb
Instance Attribute Summary collapse
-
#delegated ⇒ Object
readonly
Returns the value of attribute delegated.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#relation ⇒ Object
readonly
Returns the value of attribute relation.
Instance Method Summary collapse
- #able_to_type_cast? ⇒ Boolean
-
#initialize(relation, name, delegated) ⇒ Attribute
constructor
A new instance of Attribute.
- #lower ⇒ Object
- #method_missing(mthd, *args, **opts, &block) ⇒ Object
- #respond_to_missing?(mthd, include_private = false) ⇒ Boolean
- #type_cast_for_database(value) ⇒ Object
Constructor Details
#initialize(relation, name, delegated) ⇒ Attribute
Returns a new instance of Attribute.
10 11 12 13 14 |
# File 'lib/associate_jsonb/arel_nodes/jsonb/attribute.rb', line 10 def initialize(relation, name, delegated) @relation = relation, @name = name @delegated = delegated end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(mthd, *args, **opts, &block) ⇒ Object
32 33 34 |
# File 'lib/associate_jsonb/arel_nodes/jsonb/attribute.rb', line 32 def method_missing(mthd, *args, **opts, &block) delegated.public_send(mthd, *args, **opts, &block) end |
Instance Attribute Details
#delegated ⇒ Object (readonly)
Returns the value of attribute delegated.
8 9 10 |
# File 'lib/associate_jsonb/arel_nodes/jsonb/attribute.rb', line 8 def delegated @delegated end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/associate_jsonb/arel_nodes/jsonb/attribute.rb', line 8 def name @name end |
#relation ⇒ Object (readonly)
Returns the value of attribute relation.
8 9 10 |
# File 'lib/associate_jsonb/arel_nodes/jsonb/attribute.rb', line 8 def relation @relation end |
Instance Method Details
#able_to_type_cast? ⇒ Boolean
24 25 26 |
# File 'lib/associate_jsonb/arel_nodes/jsonb/attribute.rb', line 24 def able_to_type_cast? relation.able_to_type_cast? end |
#lower ⇒ Object
16 17 18 |
# File 'lib/associate_jsonb/arel_nodes/jsonb/attribute.rb', line 16 def lower relation.lower self end |
#respond_to_missing?(mthd, include_private = false) ⇒ Boolean
28 29 30 |
# File 'lib/associate_jsonb/arel_nodes/jsonb/attribute.rb', line 28 def respond_to_missing?(mthd, include_private = false) delegated.respond_to?(mthd, include_private) end |
#type_cast_for_database(value) ⇒ Object
20 21 22 |
# File 'lib/associate_jsonb/arel_nodes/jsonb/attribute.rb', line 20 def type_cast_for_database(value) relation.type_cast_for_database(name, value) end |