Class: Gitloggl::Gitlab::Stack::Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/gitloggl/gitlab/stack/abstract.rb

Direct Known Subclasses

DetectProject, Filter, LoadNotes, UpdateSpent

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ Abstract

Returns a new instance of Abstract.



17
18
19
20
# File 'lib/gitloggl/gitlab/stack/abstract.rb', line 17

def initialize(app, options = {})
  @app = app
  @options = options
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



7
8
9
# File 'lib/gitloggl/gitlab/stack/abstract.rb', line 7

def app
  @app
end

#envObject (readonly)

Returns the value of attribute env.



7
8
9
# File 'lib/gitloggl/gitlab/stack/abstract.rb', line 7

def env
  @env
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/gitloggl/gitlab/stack/abstract.rb', line 7

def options
  @options
end

Class Method Details

.opt(*names) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/gitloggl/gitlab/stack/abstract.rb', line 9

def self.opt(*names)
  names.each do |name|
    define_method "#{name}!" do
      options.fetch(name)
    end
  end
end

Instance Method Details

#call(env) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/gitloggl/gitlab/stack/abstract.rb', line 22

def call(env)
  @env = env

  before_call

  around_call do
    @app.call(env)
  end

  after_call
end