Class: Vissen::Parameterized::GlobalScope

Inherits:
Scope
  • Object
show all
Includes:
Singleton
Defined in:
lib/vissen/parameterized/global_scope.rb

Overview

The global scope is by definition a singleton and exists as the top level parent of all other scopes.

Instance Method Summary collapse

Methods inherited from Scope

#create_scope, #include?

Instance Method Details

#alive?true

Returns:

  • (true)

See Also:



20
21
22
# File 'lib/vissen/parameterized/global_scope.rb', line 20

def alive?
  true
end

#dead?false

The global scope can never die.

Returns:

  • (false)


13
14
15
# File 'lib/vissen/parameterized/global_scope.rb', line 13

def dead?
  false
end

#include_scope?(scope) ⇒ true, false

The only scope that is included in the global scope is the global scope itself.

Parameters:

  • scope (Object)

    the scope to check.

Returns:

  • (true)

    if the given scope is the global scope.

  • (false)

    otherwise.



35
36
37
# File 'lib/vissen/parameterized/global_scope.rb', line 35

def include_scope?(scope)
  equal?(scope)
end

#kill!Object

Raises:

  • (RuntimeError)


25
26
27
# File 'lib/vissen/parameterized/global_scope.rb', line 25

def kill!
  raise 'The global scope cannot be killed'
end

#parentObject

Raises:

  • (StopIteration)


40
41
42
# File 'lib/vissen/parameterized/global_scope.rb', line 40

def parent
  raise StopIteration
end