module Temple::Mixins::EngineDSL

@api private

Public Instance Methods

after(name, *args, &block) click to toggle source
# File lib/temple/mixins/engine_dsl.rb, line 59
def after(name, *args, &block)
  name = Class === name ? name.name.to_sym : name
  raise(ArgumentError, 'First argument must be Class or Symbol') unless Symbol === name
  e = element(args, block)
  found, i = false, 0
  while i < chain.size
    if chain[i].first == name
      found = true
      i += 1
      chain.insert(i, e)
    end
    i += 1
  end
  raise "#{name} not found" unless found
  chain_modified!
end
append(*args, &block) click to toggle source
# File lib/temple/mixins/engine_dsl.rb, line 8
def append(*args, &block)
  chain << element(args, block)
  chain_modified!
end
Also aliased as: use
before(name, *args, &block) click to toggle source
# File lib/temple/mixins/engine_dsl.rb, line 41
def before(name, *args, &block)
  name = Class === name ? name.name.to_sym : name
  raise(ArgumentError, 'First argument must be Class or Symbol') unless Symbol === name
  e = element(args, block)
  found, i = false, 0
  while i < chain.size
    if chain[i].first == name
      found = true
      chain.insert(i, e)
      i += 2
    else
      i += 1
    end
  end
  raise "#{name} not found" unless found
  chain_modified!
end
chain_modified!() click to toggle source
# File lib/temple/mixins/engine_dsl.rb, line 5
def chain_modified!
end
prepend(*args, &block) click to toggle source
# File lib/temple/mixins/engine_dsl.rb, line 13
def prepend(*args, &block)
  chain.unshift(element(args, block))
  chain_modified!
end
remove(name) click to toggle source
# File lib/temple/mixins/engine_dsl.rb, line 18
def remove(name)
  found = false
  chain.reject! do |i|
    equal = i.first == name
    found = true if equal
    equal
  end
  raise "#{name} not found" unless found
  chain_modified!
end
replace(name, *args, &block) click to toggle source
# File lib/temple/mixins/engine_dsl.rb, line 76
def replace(name, *args, &block)
  name = Class === name ? name.name.to_sym : name
  raise(ArgumentError, 'First argument must be Class or Symbol') unless Symbol === name
  e = element(args, block)
  found = false
  chain.each_with_index do |c, i|
    if c.first == name
      found = true
      chain[i] = e
    end
  end
  raise "#{name} not found" unless found
  chain_modified!
end
use(*args, &block) click to toggle source
Also aliased as: wildcard
Alias for: append
wildcard(*args, &block) click to toggle source

DEPRECATED!

wildcard(:FilterName) { FilterClass.new(options) }

is replaced by

use(:FilterName) { FilterClass.new(options) }
Alias for: use