Module: Temple::Mixins::EngineDSL Private

Included in:
Engine, Engine
Defined in:
lib/temple/mixins/engine_dsl.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary (collapse)

Instance Method Details

- (Object) after(name, *args, &block)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:

  • (ArgumentError)


49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/temple/mixins/engine_dsl.rb', line 49

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

- (Object) append(*args, &block) Also known as: use

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
11
# File 'lib/temple/mixins/engine_dsl.rb', line 8

def append(*args, &block)
  chain << element(args, block)
  chain_modified!
end

- (Object) before(name, *args, &block)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:

  • (ArgumentError)


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/temple/mixins/engine_dsl.rb', line 31

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

- (Object) chain_modified!

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



5
6
# File 'lib/temple/mixins/engine_dsl.rb', line 5

def chain_modified!
end

- (Object) filter(name, *options, &block)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



81
82
83
# File 'lib/temple/mixins/engine_dsl.rb', line 81

def filter(name, *options, &block)
  use(name, Temple::Filters.const_get(name), *options, &block)
end

- (Object) generator(name, *options, &block)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



85
86
87
# File 'lib/temple/mixins/engine_dsl.rb', line 85

def generator(name, *options, &block)
  use(name, Temple::Generators.const_get(name), *options, &block)
end

- (Object) prepend(*args, &block)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
16
# File 'lib/temple/mixins/engine_dsl.rb', line 13

def prepend(*args, &block)
  chain.unshift(element(args, block))
  chain_modified!
end

- (Object) remove(name)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



18
19
20
21
22
23
24
25
26
27
# 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

- (Object) replace(name, *args, &block)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:

  • (ArgumentError)


66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/temple/mixins/engine_dsl.rb', line 66

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