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



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

def action
  @action
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



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

def options
  @options
end

#stepObject

Returns the value of attribute step

Returns:

  • (Object)

    the current value of step



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

def step
  @step
end

Instance Method Details

#all_commandsObject



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

def all_commands
  return [] if empty_step?

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

#empty?Boolean

Returns:

  • (Boolean)


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

def empty?
  all_commands.empty?
end

#local_commandsObject



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

def local_commands
  return [] if empty_step?

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

#remote_commandsObject



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

def remote_commands
  return [] if empty_step?

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