Class: Rucc::Option

Inherits:
Object
  • Object
show all
Defined in:
lib/rucc/option.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOption

Returns a new instance of Option.



5
6
7
8
9
10
# File 'lib/rucc/option.rb', line 5

def initialize
  @include_path = []
  @dumpasm = false
  @dontlink = false
  @outfile = nil
end

Instance Attribute Details

Returns the value of attribute dontlink.



11
12
13
# File 'lib/rucc/option.rb', line 11

def dontlink
  @dontlink
end

#dumpasmObject (readonly)

Returns the value of attribute dumpasm.



11
12
13
# File 'lib/rucc/option.rb', line 11

def dumpasm
  @dumpasm
end

#include_pathObject (readonly)

Returns the value of attribute include_path.



11
12
13
# File 'lib/rucc/option.rb', line 11

def include_path
  @include_path
end

#outfileObject (readonly)

Returns the value of attribute outfile.



11
12
13
# File 'lib/rucc/option.rb', line 11

def outfile
  @outfile
end

Instance Method Details

#parse!(argv) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rucc/option.rb', line 13

def parse!(argv)
  opt = OptionParser.new
  opt.on('-I include_path') do |v|
    @include_path.push v
  end
  opt.on('-S') do
    @dumpasm = true
  end
  opt.on('-c') do
    @dontlink = true
  end
  opt.on('-o outputfile') do |v|
    @outfile = v
  end
  opt.parse!(argv)
end