Class: ParticleCMD::Info

Inherits:
Object
  • Object
show all
Defined in:
lib/particlecmd/info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Info

Returns a new instance of Info.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/particlecmd/info.rb', line 4

def initialize(argv)
  @argv        = argv
  @positionals = []
  @flags       = []
  @options     = {}
  argv.each do |word|
    if word[0] == '-'
      i = word.match(/-+(.+?)(=(.+))?$/)
      if i[3]
        @options[i[1]] = i[3]
      else
        @flags << i[1]
      end
    else
      @positionals << word
    end
  end
end

Instance Attribute Details

#argvObject

Returns the value of attribute argv.



2
3
4
# File 'lib/particlecmd/info.rb', line 2

def argv
  @argv
end

#flagsObject

Returns the value of attribute flags.



2
3
4
# File 'lib/particlecmd/info.rb', line 2

def flags
  @flags
end

#optionsObject

Returns the value of attribute options.



2
3
4
# File 'lib/particlecmd/info.rb', line 2

def options
  @options
end

#positionalsObject

Returns the value of attribute positionals.



2
3
4
# File 'lib/particlecmd/info.rb', line 2

def positionals
  @positionals
end