Class: Arel::Visitors::ProcWithSourceCollection
- Inherits:
-
Object
- Object
- Arel::Visitors::ProcWithSourceCollection
- Defined in:
- lib/arel/visitors/ruby.rb
Instance Method Summary collapse
- #call(collection) ⇒ Object
-
#initialize(procs) ⇒ ProcWithSourceCollection
constructor
A new instance of ProcWithSourceCollection.
- #to_source ⇒ Object
Constructor Details
#initialize(procs) ⇒ ProcWithSourceCollection
Returns a new instance of ProcWithSourceCollection.
315 316 317 |
# File 'lib/arel/visitors/ruby.rb', line 315 def initialize(procs) @procs = procs.flatten.compact end |
Instance Method Details
#call(collection) ⇒ Object
319 320 321 322 323 |
# File 'lib/arel/visitors/ruby.rb', line 319 def call(collection) @procs.inject(collection) do |result, lmd| lmd.call result end end |
#to_source ⇒ Object
325 326 327 |
# File 'lib/arel/visitors/ruby.rb', line 325 def to_source @procs.map(&:to_source).join('.') end |