Class: Jets::Middleware::Configurator

Inherits:
Object
  • Object
show all
Defined in:
lib/jets/middleware/configurator.rb

Instance Method Summary collapse

Constructor Details

#initialize(operations = [], delete_operations = []) ⇒ Configurator

Returns a new instance of Configurator.



32
33
34
35
# File 'lib/jets/middleware/configurator.rb', line 32

def initialize(operations = [], delete_operations = [])
  @operations = operations
  @delete_operations = delete_operations
end

Instance Method Details

#+(other) ⇒ Object

:nodoc:



71
72
73
# File 'lib/jets/middleware/configurator.rb', line 71

def +(other) # :nodoc:
  Configurator.new(@operations + other.operations, @delete_operations + other.delete_operations)
end

#delete(*args, &block) ⇒ Object



55
56
57
# File 'lib/jets/middleware/configurator.rb', line 55

def delete(*args, &block)
  @delete_operations << [__method__, args, block]
end

#insert_after(*args, &block) ⇒ Object



43
44
45
# File 'lib/jets/middleware/configurator.rb', line 43

def insert_after(*args, &block)
  @operations << [__method__, args, block]
end

#insert_before(*args, &block) ⇒ Object Also known as: insert



37
38
39
# File 'lib/jets/middleware/configurator.rb', line 37

def insert_before(*args, &block)
  @operations << [__method__, args, block]
end

#merge_into(other) ⇒ Object

:nodoc:



63
64
65
66
67
68
69
# File 'lib/jets/middleware/configurator.rb', line 63

def merge_into(other) #:nodoc:
  (@operations + @delete_operations).each do |operation, args, block|
    other.send(operation, *args, &block)
  end

  other
end

#swap(*args, &block) ⇒ Object



47
48
49
# File 'lib/jets/middleware/configurator.rb', line 47

def swap(*args, &block)
  @operations << [__method__, args, block]
end

#unshift(*args, &block) ⇒ Object



59
60
61
# File 'lib/jets/middleware/configurator.rb', line 59

def unshift(*args, &block)
  @operations << [__method__, args, block]
end

#use(*args, &block) ⇒ Object



51
52
53
# File 'lib/jets/middleware/configurator.rb', line 51

def use(*args, &block)
  @operations << [__method__, args, block]
end