Class: BabySqueel::Nodes::Proxy
- Inherits:
-
ActiveSupport::ProxyObject
- Object
- ActiveSupport::ProxyObject
- BabySqueel::Nodes::Proxy
- Defined in:
- lib/baby_squeel/nodes/proxy.rb
Overview
This proxy class allows us to quack like any arel object. When a method missing is hit, we’ll instantiate a new proxy object.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#_arel ⇒ Object
readonly
Returns the value of attribute _arel.
Class Method Summary collapse
-
.const_missing(name) ⇒ Object
Resolve constants the normal way.
Instance Method Summary collapse
-
#initialize(arel) ⇒ Proxy
constructor
A new instance of Proxy.
- #inspect ⇒ Object
- #respond_to?(meth, include_private = false) ⇒ Boolean
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Attribute Details
#_arel ⇒ Object (readonly)
Returns the value of attribute _arel.
11 12 13 |
# File 'lib/baby_squeel/nodes/proxy.rb', line 11 def _arel @_arel end |
Class Method Details
.const_missing(name) ⇒ Object
Resolve constants the normal way
7 8 9 |
# File 'lib/baby_squeel/nodes/proxy.rb', line 7 def self.const_missing(name) ::Object.const_get(name) end |
Instance Method Details
#inspect ⇒ Object
17 18 19 |
# File 'lib/baby_squeel/nodes/proxy.rb', line 17 def inspect "BabySqueel{#{super}}" end |
#respond_to?(meth, include_private = false) ⇒ Boolean
21 22 23 |
# File 'lib/baby_squeel/nodes/proxy.rb', line 21 def respond_to?(meth, include_private = false) meth.to_s == '_arel' || _arel.respond_to?(meth, include_private) end |