class OptionScrapper::Batch

Attributes

cursor[RW]
previous[RW]

Public Class Methods

new() { |self| ... } click to toggle source
# File lib/optionscrapper/batch.rb, line 11
def initialize
  @cursor   = OptionScrapper::OptionsParser::GLOBAL_PARSER
  @batches  = { OptionScrapper::OptionsParser::GLOBAL_PARSER => [] }
  @previous = nil
  yield self if block_given?
end

Public Instance Methods

add(argument) click to toggle source
# File lib/optionscrapper/batch.rb, line 25
def add(argument)
  @previous           = nil
  @batches[@cursor] ||= []
  @batches[@cursor] << argument
end
batches() { |name,arguments| ... } click to toggle source
# File lib/optionscrapper/batch.rb, line 18
def batches
  raise StandardError, 'batches: you have not supplied a block to call' unless block_given?
  @batches.each_pair do |name,arguments|
    yield name,arguments
  end
end
global(argument) click to toggle source
# File lib/optionscrapper/batch.rb, line 31
def global(argument)
  @batches[OptionScrapper::OptionsParser::GLOBAL_PARSER] << argument
end