Class: PactBroker::Api::Decorators::DecoratorContext

Inherits:
Hash
  • Object
show all
Defined in:
lib/pact_broker/api/decorators/decorator_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_url, resource_url, env, options = {}) ⇒ DecoratorContext

Returns a new instance of DecoratorContext.



7
8
9
10
11
12
13
14
# File 'lib/pact_broker/api/decorators/decorator_context.rb', line 7

def initialize base_url, resource_url, env, options = {}
  @base_url = self[:base_url] = base_url
  @resource_url = self[:resource_url] = resource_url
  @resource_title = self[:resource_title] = options[:resource_title]
  @env = self[:env] = env
  @query_string = self[:query_string] = (env["QUERY_STRING"] && !env["QUERY_STRING"].empty? ? env["QUERY_STRING"] : nil)
  merge!(options)
end

Instance Attribute Details

#base_urlObject (readonly)

Returns the value of attribute base_url.



5
6
7
# File 'lib/pact_broker/api/decorators/decorator_context.rb', line 5

def base_url
  @base_url
end

#envObject (readonly)

Returns the value of attribute env.



5
6
7
# File 'lib/pact_broker/api/decorators/decorator_context.rb', line 5

def env
  @env
end

#query_stringObject (readonly)

Returns the value of attribute query_string.



5
6
7
# File 'lib/pact_broker/api/decorators/decorator_context.rb', line 5

def query_string
  @query_string
end

#resource_titleObject (readonly)

Returns the value of attribute resource_title.



5
6
7
# File 'lib/pact_broker/api/decorators/decorator_context.rb', line 5

def resource_title
  @resource_title
end

#resource_urlObject (readonly)

Returns the value of attribute resource_url.



5
6
7
# File 'lib/pact_broker/api/decorators/decorator_context.rb', line 5

def resource_url
  @resource_url
end

Instance Method Details

#to_sObject



16
17
18
# File 'lib/pact_broker/api/decorators/decorator_context.rb', line 16

def to_s
  "DecoratorContext #{super}"
end