Class: Rubuild::Load::NameSpace::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/rubuild/load/namespace.rb

Overview

Rubuild::Load::NameSpace::Context Superclass of private execution context classes. Provides rubuild_info accessor routines.

Defined Under Namespace

Classes: Error

Class Method Summary collapse

Class Method Details

.method_added(meth) ⇒ Object

Override Class#method_added to raise an exception, and prevent users from defining functions that they will not then be able to call.



89
90
91
# File 'lib/rubuild/load/namespace.rb', line 89

def self.method_added(meth)
  raise(Error::InstanceMethod.new(self, meth))
end

.rubuild_infoObject

Retrieve the load-environment information for a Rubuild::Load::NameSpace::Context subclass. Every Rubuild::Load::NameSpace executes in a unique private subclass of Rubuild::Load::NameSpace::Context, so this class method can be called by code within the namespace to set information about the load environment. Calling

self.rubuild_info

retrieves information about the Rubuild::Load::NameSpace that was set when the Rubuild::Load::NameSpace was created.



82
83
84
85
# File 'lib/rubuild/load/namespace.rb', line 82

def self.rubuild_info
  # see above.
  @rubuild_info
end

.rubuild_info=(info) ⇒ Object

Set the load-environment information for a Rubuild::Load::NameSpace::Context subclass. Every Rubuild::Load::NameSpace executes in a unique private subclass of Rubuild::Load::NameSpace::Context, so this class method can be called by code within the namespace to set information about the load environment. Used internally directly after creating a new Rubuild::Load::NameSpace.

info

New load-environment information for a Rubuild::Load::NameSpace::Context subclass.



66
67
68
69
70
71
# File 'lib/rubuild/load/namespace.rb', line 66

def self.rubuild_info=(info)
  # Note: this object is the 'Context' instance of the 'Class' class.
  # This is as opposed to a variable instance of the 'Context' class.
  # We can use @instance_variable uniquely in this class.
  @rubuild_info = info
end