Class: Riddler::ContextDirector

Inherits:
Object
  • Object
show all
Defined in:
lib/riddler/context_director.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ContextDirector

Returns a new instance of ContextDirector.



6
7
8
9
10
11
12
13
# File 'lib/riddler/context_director.rb', line 6

def initialize options={}
  options = {} if options.nil?
  @params = options[:params] || options["params"]
  @headers = options[:headers] || options["headers"]
  @ctx = ::Riddler::Context.new params: params, headers: headers
  @ids_extracted = false
  @builders_applied = false
end

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



4
5
6
# File 'lib/riddler/context_director.rb', line 4

def headers
  @headers
end

#paramsObject (readonly)

Returns the value of attribute params.



4
5
6
# File 'lib/riddler/context_director.rb', line 4

def params
  @params
end

Instance Method Details

#contextObject

Create a new context and use registered builders to fill it in



22
23
24
25
26
# File 'lib/riddler/context_director.rb', line 22

def context
  extract_ids
  apply_builders
  @ctx
end

#simple_contextObject

Return the context with only IDs extracted



16
17
18
19
# File 'lib/riddler/context_director.rb', line 16

def simple_context
  extract_ids
  @ctx
end