Module: Truck
- Extended by:
- Truck
- Included in:
- Truck
- Defined in:
- lib/truck.rb,
lib/truck/context.rb,
lib/truck/version.rb,
lib/truck/autoloader.rb,
lib/truck/const_resolver.rb,
lib/truck/string_inflections.rb
Defined Under Namespace
Modules: StringInflections
Classes: AutoloadError, Autoloader, Context
Constant Summary
collapse
- Error =
Class.new StandardError
- VERSION =
"0.8.7"
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#contexts ⇒ Object
Returns the value of attribute contexts.
10
11
12
|
# File 'lib/truck.rb', line 10
def contexts
@contexts
end
|
#debug_mode ⇒ Object
Returns the value of attribute debug_mode.
13
14
15
|
# File 'lib/truck.rb', line 13
def debug_mode
@debug_mode
end
|
Instance Method Details
#boot! ⇒ Object
25
26
27
|
# File 'lib/truck.rb', line 25
def boot!
contexts.each_value &:boot!
end
|
#define_context(name, params = {}) ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'lib/truck.rb', line 15
def define_context(name, params = {})
root, parent, autoload_paths = (
params,
:root,
parent: nil,
autoload_paths: ['.'],
)
contexts[name] = Context.new(name, root, parent, autoload_paths)
end
|
#reset! ⇒ Object
Also known as:
reload!
29
30
31
32
|
# File 'lib/truck.rb', line 29
def reset!
shutdown!
boot!
end
|
#shutdown! ⇒ Object
35
36
37
|
# File 'lib/truck.rb', line 35
def shutdown!
each_booted_context.to_a.reverse.each &:shutdown!
end
|