Class: Pug::Interfaces::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/pug/interfaces/action.rb

Overview

Abstract interface representing an Action

Direct Known Subclasses

HelpAction, ListAction

Instance Method Summary collapse

Instance Method Details

#descriptionString

Optional description for the action

Returns:

  • (String)

    Action description



15
16
17
# File 'lib/pug/interfaces/action.rb', line 15

def description
  ''
end

#execute(input) ⇒ String

Note:

This can return nil if there is no output

Entry point for Action with provided input if any

Parameters:

  • input (String)

    The optional input for the Action

Returns:

  • (String)

    The output of running the Action

Raises:

  • (NoMethodError)


30
31
32
# File 'lib/pug/interfaces/action.rb', line 30

def execute(input) # rubocop:disable UnusedMethodArgument
  raise NoMethodError
end

#nameString

The human readable name for the Action

Returns:

Raises:

  • (NoMethodError)


9
10
11
# File 'lib/pug/interfaces/action.rb', line 9

def name
  raise NoMethodError
end

#requires_input?Boolean

Note:

Defaults to false

Indicates if the action requires an input

Returns:

  • (Boolean)

    if input is required



22
23
24
# File 'lib/pug/interfaces/action.rb', line 22

def requires_input?
  false
end