Class: Gitlab::Ci::Build::Hook

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/ci/build/hook.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, script) ⇒ Hook

Returns a new instance of Hook.



17
18
19
20
# File 'lib/gitlab/ci/build/hook.rb', line 17

def initialize(name, script)
  @name = name
  @script = script
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/gitlab/ci/build/hook.rb', line 7

def name
  @name
end

#scriptObject (readonly)

Returns the value of attribute script.



7
8
9
# File 'lib/gitlab/ci/build/hook.rb', line 7

def script
  @script
end

Class Method Details

.from_hooks(job) ⇒ Object



10
11
12
13
14
# File 'lib/gitlab/ci/build/hook.rb', line 10

def from_hooks(job)
  job.options[:hooks].to_a.map do |name, script|
    new(name.to_s, script)
  end
end