Class: YASM::Program

Inherits:
RProgram::Program
  • Object
show all
Defined in:
lib/yasm/program.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.assemble_temp(options = {}) {|task| ... } ⇒ TempFile

Finds the yasm program, then assembles an assembly file and writes the output to a temporary file.

Parameters:

  • options (Hash{Symbol => Object}) (defaults to: {})

    Additional options for yasm.

Yields:

  • (task)

    If a block is given, it will be passed a task object used to specify options for yasm.

Yield Parameters:

  • task (Task)

    The yasm task object.

Returns:

  • (TempFile)

    The temporary file containing the assembled object code.



48
49
50
# File 'lib/yasm/program.rb', line 48

def self.assemble_temp(options={},&block)
  self.find().assemble(options,&block)
end

.assmeble(options = {}) {|task| ... } ⇒ Boolean

Finds the yasm program and assembles a file.

Parameters:

  • options (Hash{Symbol => Object}) (defaults to: {})

    Additional options for yasm.

Yields:

  • (task)

    If a block is given, it will be passed a task object used to specify options for yasm.

Yield Parameters:

  • task (Task)

    The yasm task object.

Returns:

  • (Boolean)

    Specifies whether the command exited normally.



27
28
29
# File 'lib/yasm/program.rb', line 27

def self.assmeble(options={},&block)
  self.find().assemble(options,&block)
end

Instance Method Details

#assemble(options = {}) {|task| ... } ⇒ Boolean

Assembles an assembly file.

Parameters:

  • options (Hash{Symbol => Object}) (defaults to: {})

    Additional options for yasm.

Yields:

  • (task)

    If a block is given, it will be passed a task object used to specify options for yasm.

Yield Parameters:

  • task (Task)

    The yasm task object.

Returns:

  • (Boolean)

    Specifies whether the command exited normally.



68
69
70
# File 'lib/yasm/program.rb', line 68

def assemble(options={},&block)
  run_task(Task.new(options,&block))
end

#assemble_temp(options = {}) {|task| ... } ⇒ TempFile

Assembles an assembly file and writes the output to a temporary file.

Parameters:

  • options (Hash{Symbol => Object}) (defaults to: {})

    Additional options for yasm.

Yields:

  • (task)

    If a block is given, it will be passed a task object used to specify options for yasm.

Yield Parameters:

  • task (Task)

    The yasm task object.

Returns:

  • (TempFile)

    The temporary file containing the assembled object code.



88
89
90
91
92
93
94
95
# File 'lib/yasm/program.rb', line 88

def assemble_temp(options={},&block)
  task = Task.new(options,&block)
  task.output = Tempfile.new('yasm').path

  if run_task(task)
    return task.output
  end
end