Class: Ansr::Arel::ConfiguredField
- Inherits:
-
Arel::Attributes::Attribute
- Object
- Arel::Attributes::Attribute
- Ansr::Arel::ConfiguredField
- Defined in:
- lib/ansr/arel/configured_field.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(relation, name, config = {}) ⇒ ConfiguredField
constructor
A new instance of ConfiguredField.
- #local ⇒ Object
- #method_missing(method, *args) ⇒ Object
- #query ⇒ Object
Constructor Details
#initialize(relation, name, config = {}) ⇒ ConfiguredField
Returns a new instance of ConfiguredField.
4 5 6 7 |
# File 'lib/ansr/arel/configured_field.rb', line 4 def initialize(relation, name, config={}) super(relation, name) @config = {local: {}, query: {}}.merge(config) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
14 15 16 17 |
# File 'lib/ansr/arel/configured_field.rb', line 14 def method_missing(method, *args) @config[method] = args if args.first @config[method] end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/ansr/arel/configured_field.rb', line 3 def config @config end |
Instance Method Details
#local ⇒ Object
11 12 13 |
# File 'lib/ansr/arel/configured_field.rb', line 11 def local @config[:local] end |
#query ⇒ Object
8 9 10 |
# File 'lib/ansr/arel/configured_field.rb', line 8 def query @config[:query] end |