Class: Stackup::RakeTasks::DataOption
- Inherits:
-
Object
- Object
- Stackup::RakeTasks::DataOption
- Defined in:
- lib/stackup/rake_tasks.rb
Overview
A flag with optional argument that will be passed to stackup
Direct Known Subclasses
Instance Attribute Summary collapse
-
#argument ⇒ Object
readonly
Returns the value of attribute argument.
-
#flag ⇒ Object
readonly
Returns the value of attribute flag.
Class Method Summary collapse
-
.for(flag, argument) ⇒ Object
Factory method for initialising DataOptions based on class.
Instance Method Summary collapse
-
#initialize(flag, argument) ⇒ DataOption
constructor
A new instance of DataOption.
- #to_a ⇒ Object
Constructor Details
#initialize(flag, argument) ⇒ DataOption
Returns a new instance of DataOption.
85 86 87 88 |
# File 'lib/stackup/rake_tasks.rb', line 85 def initialize(flag, argument) @flag = flag @argument = argument end |
Instance Attribute Details
#argument ⇒ Object (readonly)
Returns the value of attribute argument.
108 109 110 |
# File 'lib/stackup/rake_tasks.rb', line 108 def argument @argument end |
#flag ⇒ Object (readonly)
Returns the value of attribute flag.
107 108 109 |
# File 'lib/stackup/rake_tasks.rb', line 107 def flag @flag end |
Class Method Details
.for(flag, argument) ⇒ Object
Factory method for initialising DataOptions based on class
95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/stackup/rake_tasks.rb', line 95 def self.for(flag, argument) if argument.is_a?(Hash) DataOptionHash.new(flag, argument) elsif argument.is_a?(Array) DataOptionArray.new(flag, argument) elsif argument.is_a?(String) && File.exist?(argument) DataOptionFile.new(flag, argument) else DataOption.new(flag, argument) end end |
Instance Method Details
#to_a ⇒ Object
90 91 92 |
# File 'lib/stackup/rake_tasks.rb', line 90 def to_a [@flag, @argument] end |