Module: Dynaload
- Extended by:
- Sync_m
- Defined in:
- lib/dynaload.rb,
lib/dynaload-0.2.1.rb
Defined Under Namespace
Classes: ExportError, Exported
Constant Summary
collapse
- VERSION =
'0.2.0'
Class Method Summary
collapse
Class Method Details
.dynaload(path, opts = {"wrap" => true}) ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/dynaload.rb', line 51
def dynaload path, opts = {"wrap" => true}
ret = nil
synchronize do
begin
@exported = Exported::new
::Kernel::load(path, opts["wrap"] || opts[:wrap])
raise ExportError, "no dynamic exports from <#{ path }>!" if
@exported.nil? or @exported.empty?
ret = @exported
ensure
@exported = nil
end
end
ret
end
|
.export(thing, attributes = {}) ⇒ Object
47
48
49
|
# File 'lib/dynaload.rb', line 47
def export thing, attributes = {}
synchronize{ exported.export thing, attributes }
end
|
.exported ⇒ Object
43
44
45
|
# File 'lib/dynaload.rb', line 43
def exported
synchronize{ @exported ||= Exported::new }
end
|