Class: Verneuil::Block

Inherits:
Object
  • Object
show all
Defined in:
lib/verneuil/block.rb

Overview

Abstracts the notion of a block.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address, process, scope) ⇒ Block

Returns a new instance of Block.



9
10
11
12
13
# File 'lib/verneuil/block.rb', line 9

def initialize(address, process, scope)
  @address  = address
  @process  = process
  @scope    = scope
end

Instance Attribute Details

#addressObject (readonly)

At what address does the block code start?



6
7
8
# File 'lib/verneuil/block.rb', line 6

def address
  @address
end

#scopeObject (readonly)

Returns the value of attribute scope.



7
8
9
# File 'lib/verneuil/block.rb', line 7

def scope
  @scope
end

Instance Method Details

#call(*args) ⇒ Object



15
16
17
18
# File 'lib/verneuil/block.rb', line 15

def call(*args)
  @process.enter_block(args, @address, @scope)
  throw :verneuil_code
end

#inspectObject



20
21
22
# File 'lib/verneuil/block.rb', line 20

def inspect
  "block@#{@address.ip}(#{@scope.inspect})"
end