Class: Crabfarm::Context

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/crabfarm/context.rb

Direct Known Subclasses

CrabtrapContext, Live::Context

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeContext

Returns a new instance of Context.



7
8
9
10
# File 'lib/crabfarm/context.rb', line 7

def initialize
  @store = StateStore.new
  @loaded = false
end

Instance Attribute Details

#poolObject

Returns the value of attribute pool.



5
6
7
# File 'lib/crabfarm/context.rb', line 5

def pool
  @pool
end

#storeObject

Returns the value of attribute store.



5
6
7
# File 'lib/crabfarm/context.rb', line 5

def store
  @store
end

Instance Method Details

#loaded?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/crabfarm/context.rb', line 12

def loaded?
  @loaded
end

#prepareObject



16
17
18
19
20
21
# File 'lib/crabfarm/context.rb', line 16

def prepare
  unless @loaded
    load_services
    @loaded = true
  end
end

#releaseObject



27
28
29
30
# File 'lib/crabfarm/context.rb', line 27

def release
  unload_services
  @loaded = false
end

#resetObject



23
24
25
# File 'lib/crabfarm/context.rb', line 23

def reset
  reset_services if @loaded
end