Class: Apirelio::Rack::Context
- Inherits:
-
Object
- Object
- Apirelio::Rack::Context
- Defined in:
- lib/apirelio/rack/context.rb
Instance Attribute Summary collapse
-
#error_code ⇒ Object
Returns the value of attribute error_code.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
Instance Method Summary collapse
- #add_metadata(values) ⇒ Object
-
#initialize ⇒ Context
constructor
A new instance of Context.
- #set_error_code(value) ⇒ Object
Constructor Details
#initialize ⇒ Context
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_code ⇒ Object
Returns the value of attribute error_code.
7 8 9 |
# File 'lib/apirelio/rack/context.rb', line 7 def error_code @error_code end |
#metadata ⇒ Object (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 |