Class: Commandorobo::Arguments
- Inherits:
-
Object
- Object
- Commandorobo::Arguments
- Defined in:
- lib/commandorobo.rb
Overview
Class that gets passed to any block defined in Bot#cmd. Represents arguments.
Instance Attribute Summary collapse
-
#raw ⇒ Array
readonly
The unprocessed array of strings that make up the arguments.
Instance Method Summary collapse
-
#initialize(raw) ⇒ Arguments
constructor
A new instance of Arguments.
-
#noswitch ⇒ String
Leverages a utility function to remove switches.
-
#switches ⇒ Hash
Leverages a utility function to grab switch information.
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
#raw ⇒ Array (readonly)
The unprocessed array of strings that make up the arguments.
90 91 92 |
# File 'lib/commandorobo.rb', line 90 def raw @raw end |
Instance Method Details
#noswitch ⇒ String
Leverages a utility function to remove switches.
104 105 106 |
# File 'lib/commandorobo.rb', line 104 def noswitch Commandorobo::Utils::remove_switch(@raw.join(' ')) end |
#switches ⇒ Hash
Leverages a utility function to grab switch information.
98 99 100 |
# File 'lib/commandorobo.rb', line 98 def switches Commandorobo::Utils::consume_switch(@raw.join(' ')) end |