Class: Apirelio::Rack::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/apirelio/rack/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeContext

Returns a new instance of Context.



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

def initialize
  @metadata = {}
  @error_code = nil
end

Instance Attribute Details

#error_codeObject

Returns the value of attribute error_code.



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

def error_code
  @error_code
end

#metadataObject (readonly)

Returns the value of attribute metadata.



6
7
8
# File 'lib/apirelio/rack/context.rb', line 6

def 
  @metadata
end

Instance Method Details

#add_metadata(values) ⇒ Object



14
15
16
17
# File 'lib/apirelio/rack/context.rb', line 14

def (values)
  @metadata.merge!(values)
  self
end

#set_error_code(value) ⇒ Object



19
20
21
22
# File 'lib/apirelio/rack/context.rb', line 19

def set_error_code(value)
  @error_code = value&.to_s&.slice(0, 255)
  self
end