Class: Commandorobo::Arguments

Inherits:
Object
  • Object
show all
Defined in:
lib/commandorobo.rb

Overview

Class that gets passed to any block defined in Bot#cmd. Represents arguments.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ Arguments

Returns a new instance of Arguments.



92
93
94
# File 'lib/commandorobo.rb', line 92

def initialize(raw)
    @raw = raw
end

Instance Attribute Details

#rawArray (readonly)

The unprocessed array of strings that make up the arguments.

Returns:

  • (Array)

    the current value of raw



90
91
92
# File 'lib/commandorobo.rb', line 90

def raw
  @raw
end

Instance Method Details

#noswitchString

Leverages a utility function to remove switches.

Returns:

  • (String)

    The ‘switchless’ version of the arguments.



104
105
106
# File 'lib/commandorobo.rb', line 104

def noswitch
    Commandorobo::Utils::remove_switch(@raw.join(' '))
end

#switchesHash

Leverages a utility function to grab switch information.

Returns:

  • (Hash)

    The switches.



98
99
100
# File 'lib/commandorobo.rb', line 98

def switches
    Commandorobo::Utils::consume_switch(@raw.join(' '))
end