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.4"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextsObject (readonly)

Returns the value of attribute contexts.



10
11
12
# File 'lib/truck.rb', line 10

def contexts
  @contexts
end

Instance Method Details

#boot!Object



17
18
19
# File 'lib/truck.rb', line 17

def boot!
  contexts.each_value &:boot!
end

#define_context(name, **params) ⇒ Object



13
14
15
# File 'lib/truck.rb', line 13

def define_context(name, **params)
  contexts[name] = Context.new(name, **params)
end

#reset!Object Also known as: reload!



21
22
23
24
# File 'lib/truck.rb', line 21

def reset!
  shutdown!
  boot!
end

#shutdown!Object



27
28
29
# File 'lib/truck.rb', line 27

def shutdown!
  each_booted_context.to_a.reverse.each &:shutdown!
end