Class: ActiveRecord::QueryMethods::WhereIs

Inherits:
Object
  • Object
show all
Defined in:
lib/where-is-rails/where-is-rails.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arel, &block) ⇒ WhereIs

Returns a new instance of WhereIs.



63
64
65
66
# File 'lib/where-is-rails/where-is-rails.rb', line 63

def initialize(arel, &block)
  @arel = arel
  self.result = instance_exec(&block)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, _params = {}) ⇒ Object



68
69
70
# File 'lib/where-is-rails/where-is-rails.rb', line 68

def method_missing(method_name, _params = {})
  WhereIsArel.new @arel[method_name]
end

Instance Attribute Details

#result ⇒ Object

Returns the value of attribute result.



61
62
63
# File 'lib/where-is-rails/where-is-rails.rb', line 61

def result
  @result
end