Class: Warg::Context
Instance Attribute Summary collapse
-
#argv ⇒ Object
readonly
Returns the value of attribute argv.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
-
#playlist ⇒ Object
readonly
Returns the value of attribute playlist.
Attributes inherited from Config
#default_user, #hosts, #variables_sets
Instance Method Summary collapse
- #copy(config) ⇒ Object
-
#initialize(argv, playlist) ⇒ Context
constructor
A new instance of Context.
- #parse_options! ⇒ Object
Methods inherited from Config
#[], #variables, #variables_set_defined?
Constructor Details
#initialize(argv, playlist) ⇒ Context
Returns a new instance of Context.
1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 |
# File 'lib/warg.rb', line 1355 def initialize(argv, playlist) @argv = argv @playlist = playlist @parser = OptionParser.new @parser.on("-t", "--target HOSTS", Array, "hosts to use") do |hosts_data| hosts_data.each { |host_data| hosts.add(host_data) } end super() end |
Instance Attribute Details
#argv ⇒ Object (readonly)
Returns the value of attribute argv.
1351 1352 1353 |
# File 'lib/warg.rb', line 1351 def argv @argv end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
1352 1353 1354 |
# File 'lib/warg.rb', line 1352 def parser @parser end |
#playlist ⇒ Object (readonly)
Returns the value of attribute playlist.
1353 1354 1355 |
# File 'lib/warg.rb', line 1353 def playlist @playlist end |
Instance Method Details
#copy(config) ⇒ Object
1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 |
# File 'lib/warg.rb', line 1371 def copy(config) config.hosts.each do |host| hosts.add(host) end config.variables_sets.each do |variables_name| variables(variables_name) do |variables_object| variables_object.copy config.instance_variable_get("@#{variables_name}") end end end |
#parse_options! ⇒ Object
1367 1368 1369 |
# File 'lib/warg.rb', line 1367 def @parser.parse(@argv) end |