Class: Belafonte::Argument

Inherits:
Object
  • Object
show all
Defined in:
lib/belafonte/argument.rb,
lib/belafonte/argument/argv_processor.rb,
lib/belafonte/argument/occurrence_normalizer.rb,
lib/belafonte/argument/argv_processor/processor.rb,
lib/belafonte/argument/argv_processor/unlimited.rb,
lib/belafonte/argument/occurrence_normalizer/single.rb,
lib/belafonte/argument/occurrence_normalizer/unlimited.rb,
lib/belafonte/argument/occurrence_normalizer/normalizer.rb

Overview

Represents a command line argument

Defined Under Namespace

Modules: ARGVProcessor, OccurrenceNormalizer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Argument

Returns a new instance of Argument.



10
11
12
13
14
# File 'lib/belafonte/argument.rb', line 10

def initialize(options = {})
  @name = options[:name]
  @times = options[:times]
  normalize
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/belafonte/argument.rb', line 8

def name
  @name
end

#timesObject (readonly)

Returns the value of attribute times.



8
9
10
# File 'lib/belafonte/argument.rb', line 8

def times
  @times
end

Instance Method Details

#process(argv) ⇒ Object



16
17
18
# File 'lib/belafonte/argument.rb', line 16

def process(argv)
  ARGVProcessor.process(times, argv).clone
end

#unlimited?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/belafonte/argument.rb', line 20

def unlimited?
  @unlimited ||= false
end