Class: Comet::DSL::Linker

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/comet/dsl/linker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#quote

Constructor Details

#initialize(triple, isa:, cpu:, opt:, &block) ⇒ Linker

Returns a new instance of Linker.



15
16
17
18
19
20
21
22
23
24
# File 'lib/comet/dsl/linker.rb', line 15

def initialize(triple, isa:, cpu:, opt:, &block)
  @triple = triple
  @isa = isa
  @cpu = cpu
  @options = Options.new
  @opt = opt
  @script = nil

  instance_exec(&block) if block_given?
end

Instance Attribute Details

#cpuObject (readonly)

Returns the value of attribute cpu.



32
33
34
# File 'lib/comet/dsl/linker.rb', line 32

def cpu
  @cpu
end

#isaObject (readonly)

Returns the value of attribute isa.



31
32
33
# File 'lib/comet/dsl/linker.rb', line 31

def isa
  @isa
end

#optObject (readonly)

Returns the value of attribute opt.



34
35
36
# File 'lib/comet/dsl/linker.rb', line 34

def opt
  @opt
end

#optionsObject (readonly)

Returns the value of attribute options.



33
34
35
# File 'lib/comet/dsl/linker.rb', line 33

def options
  @options
end

#tripleObject (readonly)

Returns the value of attribute triple.



30
31
32
# File 'lib/comet/dsl/linker.rb', line 30

def triple
  @triple
end

Instance Method Details

#option(*args, **kwargs) ⇒ Object



11
12
13
# File 'lib/comet/dsl/linker.rb', line 11

def option(*args, **kwargs)
  @options.add('', *args, **kwargs)
end

#script(script) ⇒ Object



7
8
9
# File 'lib/comet/dsl/linker.rb', line 7

def script(script)
  @script = script
end

#script_Object



36
37
38
# File 'lib/comet/dsl/linker.rb', line 36

def script_
  @script
end

#to_sObject



26
27
28
# File 'lib/comet/dsl/linker.rb', line 26

def to_s
  "linker #{@triple}"
end

#validate!Object



40
41
42
# File 'lib/comet/dsl/linker.rb', line 40

def validate!
  raise "#{self} triple is invalid" if @triple.strip.empty?
end