Class: Rubuild::Env::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/rubuild/env/location.rb

Overview

Rubuild::Env::Location A loaded interface to a source module.

Defined Under Namespace

Classes: Error

Instance Method Summary collapse

Constructor Details

#initialize(name, depfactory) ⇒ Location

Returns a new instance of Location.



65
66
67
68
69
70
71
72
73
74
# File 'lib/rubuild/env/location.rb', line 65

def initialize(name, depfactory)
  self.rubuild_env_location__name = name
  self.rubuild_env_location__depfactory = depfactory

  self.rubuild_env_location__found_dep = 
    self.rubuild_env_location__depfactory.create_dep(
    self.method(:_found_depaction),
    self.class.to_s + '#found#' + self.rubuild_env_location__name
    )
end

Instance Method Details

#_found_depaction(dep) ⇒ Object



76
77
78
79
80
81
82
83
84
# File 'lib/rubuild/env/location.rb', line 76

def _found_depaction(dep)
  # called when the "found_dep" is satisifed.
  # ensure that data was found, and lose references to unneeded state
  # variables.
  self.rubuild_env_location__depfactory = nil
  if ! self.rubuild_env_location__have_data
    raise(Error::BuiltEmpty.new(self))
  end
end

#dataObject



97
98
99
100
101
102
# File 'lib/rubuild/env/location.rb', line 97

def data
  if ! self.rubuild_env_location__have_data
    raise(Error::DataEmpty.new(self))
  end
  self.rubuild_env_location__data
end

#selfObject

Rubuild::Env::Location



56
# File 'lib/rubuild/env/location.rb', line 56

Safer::IVar.instance_variable(self, :found_dep)

#set_data(data) ⇒ Object



86
87
88
89
90
91
92
93
94
95
# File 'lib/rubuild/env/location.rb', line 86

def set_data(data)
  if self.rubuild_env_location__have_data
    raise(Error::SetData::Already.new(self, data))
  end
  self.rubuild_env_location__data = data
  self.rubuild_env_location__have_data = true
  # data's found, call its routine to clean up.
  # (this could maybe be a little cleaner)
  self._found_depaction(self.rubuild_env_location__found_dep)
end