Class: Reviewer::Command::String::Flags
- Inherits:
-
Object
- Object
- Reviewer::Command::String::Flags
- Defined in:
- lib/reviewer/command/string/flags.rb
Overview
Translates tool flag settings from the tool’s configuration values into a single string or
array that can be used to generate the command string
Instance Attribute Summary collapse
-
#flag_pairs ⇒ Object
readonly
Returns the value of attribute flag_pairs.
Instance Method Summary collapse
-
#initialize(flag_pairs) ⇒ self
constructor
Creates an instance of command-string friendly flags.
-
#to_a ⇒ Array<String>
Creates an array of all flag name/value pairs.
-
#to_s ⇒ String
Creates a string-friendly format to use in a command.
Constructor Details
#initialize(flag_pairs) ⇒ self
Creates an instance of command-string friendly flags
15 16 17 |
# File 'lib/reviewer/command/string/flags.rb', line 15 def initialize(flag_pairs) @flag_pairs = flag_pairs end |
Instance Attribute Details
#flag_pairs ⇒ Object (readonly)
Returns the value of attribute flag_pairs.
9 10 11 |
# File 'lib/reviewer/command/string/flags.rb', line 9 def flag_pairs @flag_pairs end |
Instance Method Details
#to_a ⇒ Array<String>
Creates an array of all flag name/value pairs
29 30 31 32 33 |
# File 'lib/reviewer/command/string/flags.rb', line 29 def to_a flags = [] flag_pairs.each { |key, value| flags << flag(key, value) } flags end |
#to_s ⇒ String
Creates a string-friendly format to use in a command
22 23 24 |
# File 'lib/reviewer/command/string/flags.rb', line 22 def to_s to_a.join(' ') end |