Class: Automux::Core::Hook

Inherits:
Object
  • Object
show all
Defined in:
lib/automux/core/hook.rb

Constant Summary collapse

PRE =
2
POST =
4

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target, type, command) ⇒ Hook

Returns a new instance of Hook.



12
13
14
15
# File 'lib/automux/core/hook.rb', line 12

def initialize(target, type, command)
  @type = self.class.const_get(type.upcase)
  @command = ERB.new(command).result(target.get_binding)
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



9
10
11
# File 'lib/automux/core/hook.rb', line 9

def command
  @command
end

Instance Method Details

#post?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/automux/core/hook.rb', line 21

def post?
  type == POST
end

#pre?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/automux/core/hook.rb', line 17

def pre?
  type == PRE
end