Class: Wordmove::Hook::Config

Inherits:
Struct
  • Object
show all
Defined in:
lib/wordmove/hook.rb

Overview

rubocop:enable Metrics/MethodLength

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actionObject

Returns the value of attribute action

Returns:

  • (Object)

    the current value of action



41
42
43
# File 'lib/wordmove/hook.rb', line 41

def action
  @action
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



41
42
43
# File 'lib/wordmove/hook.rb', line 41

def options
  @options
end

#stepObject

Returns the value of attribute step

Returns:

  • (Object)

    the current value of step



41
42
43
# File 'lib/wordmove/hook.rb', line 41

def step
  @step
end

Instance Method Details

#all_commandsObject



46
47
48
49
50
# File 'lib/wordmove/hook.rb', line 46

def all_commands
  return [] if empty_step?

  options[action][step] || []
end

#empty?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/wordmove/hook.rb', line 42

def empty?
  all_commands.empty?
end

#local_commandsObject



52
53
54
55
56
57
# File 'lib/wordmove/hook.rb', line 52

def local_commands
  return [] if empty_step?

  options[action][step]
    .select { |hook| hook[:where] == 'local' } || []
end

#remote_commandsObject



59
60
61
62
63
64
# File 'lib/wordmove/hook.rb', line 59

def remote_commands
  return [] if empty_step?

  options[action][step]
    .select { |hook| hook[:where] == 'remote' } || []
end