Class: Comet::DSL::Target

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#quote

Constructor Details

#initialize(device, &block) ⇒ Target

Returns a new instance of Target.



23
24
25
26
27
28
29
30
31
# File 'lib/comet/dsl/target.rb', line 23

def initialize(device, &block)
  @elf_output = nil
  @bin_output = nil
  @hex_output = nil
  @map_output = nil
  @device = device

  instance_exec(&block) if block_given?
end

Instance Attribute Details

#bin_outputObject (readonly)

Returns the value of attribute bin_output.



38
39
40
# File 'lib/comet/dsl/target.rb', line 38

def bin_output
  @bin_output
end

#elf_outputObject (readonly)

Returns the value of attribute elf_output.



37
38
39
# File 'lib/comet/dsl/target.rb', line 37

def elf_output
  @elf_output
end

#hex_outputObject (readonly)

Returns the value of attribute hex_output.



39
40
41
# File 'lib/comet/dsl/target.rb', line 39

def hex_output
  @hex_output
end

#map_outputObject (readonly)

Returns the value of attribute map_output.



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

def map_output
  @map_output
end

Instance Method Details

#bin(path) ⇒ Object



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

def bin(path)
  @bin_output = BinOutput.new(path)
end

#bin?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/comet/dsl/target.rb', line 46

def bin?
  !@bin_output.nil?
end

#elf(path) ⇒ Object



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

def elf(path)
  @elf_output = ElfOutput.new(path)
end

#elf?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/comet/dsl/target.rb', line 42

def elf?
  !@elf_output.nil?
end

#hex(path) ⇒ Object



15
16
17
# File 'lib/comet/dsl/target.rb', line 15

def hex(path)
  @hex_output = HexOutput.new(path)
end

#hex?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/comet/dsl/target.rb', line 50

def hex?
  !@hex_output.nil?
end

#map(path) ⇒ Object



19
20
21
# File 'lib/comet/dsl/target.rb', line 19

def map(path)
  @map_output = MapOutput.new(path)
end

#map?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/comet/dsl/target.rb', line 54

def map?
  !@map_output.nil?
end

#to_sObject



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

def to_s
  "target for #{@device}"
end

#validate!Object



58
59
60
61
# File 'lib/comet/dsl/target.rb', line 58

def validate!
  has_outputs = [elf?, bin?, hex?, map?].any?
  raise "#{self} describes no outputs" unless has_outputs
end