class Mysh::Action

The mysh internal action class.

Attributes

description[R]

The description of the action.

name[R]

The name of the action.

Public Class Methods

new(name = "", description = "", &action) click to toggle source

Setup an internal action.

# File lib/mysh/action.rb, line 15
def initialize(name = "", description = "", &action)
  @name, @description = name, description.in_array

  define_singleton_method(:process_command, &action) if block_given?
end

Public Instance Methods

action_info() click to toggle source

Get information about the action.

# File lib/mysh/action.rb, line 28
def action_info
  [@name].concat(@description)
end
process_quick_command(input) click to toggle source

Parse the string and call the action.

# File lib/mysh/action.rb, line 22
def process_quick_command(input)
  process_command(input.quick)
  :internal
end
short_name() click to toggle source

Get the name without any argument descriptions.

# File lib/mysh/action.rb, line 33
def short_name
  name.split[0] || ""
end