Module: Tins::GO::ArrayExtension
- Defined in:
- lib/tins/go.rb
Overview
A module that provides extension methods for Strings let them double as arrays.
Instance Method Summary collapse
-
#push(argument) ⇒ self
Adds an element to the collection.
-
#to_a ⇒ Array
The to_a method converts the object to an array.
Instance Method Details
#push(argument) ⇒ self
Adds an element to the collection.
This method allows for chaining operations and collects multiple values for the same command-line option.
28 29 30 31 32 |
# File 'lib/tins/go.rb', line 28 def push(argument) @arguments ||= [] @arguments.push argument self end |
#to_a ⇒ Array
The to_a method converts the object to an array.
36 37 38 |
# File 'lib/tins/go.rb', line 36 def to_a @arguments end |