Class: Crabfarm::Context

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

Direct Known Subclasses

CrabtrapContext

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeContext

Returns a new instance of Context.



9
10
11
12
# File 'lib/crabfarm/context.rb', line 9

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

Instance Attribute Details

#httpObject

Returns the value of attribute http.



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

def http
  @http
end

#poolObject

Returns the value of attribute pool.



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

def pool
  @pool
end

#storeObject

Returns the value of attribute store.



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

def store
  @store
end

Instance Method Details

#loaded?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/crabfarm/context.rb', line 14

def loaded?
  @loaded
end

#prepareObject



18
19
20
21
22
23
# File 'lib/crabfarm/context.rb', line 18

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

#releaseObject



29
30
31
32
# File 'lib/crabfarm/context.rb', line 29

def release
  unload_services
  @loaded = false
end

#resetObject



25
26
27
# File 'lib/crabfarm/context.rb', line 25

def reset
  reset_services if @loaded
end