Class: Injector
- Inherits:
-
Object
- Object
- Injector
- Includes:
- Singleton
- Defined in:
- lib/greenlight/injector.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
Returns the value of attribute headers.
Class Method Summary collapse
Instance Method Summary collapse
- #add_header(header, value) ⇒ Object
-
#initialize ⇒ Injector
constructor
A new instance of Injector.
- #rm_header(header) ⇒ Object
Constructor Details
#initialize ⇒ Injector
Returns a new instance of Injector.
8 9 10 |
# File 'lib/greenlight/injector.rb', line 8 def initialize self.headers = {} end |
Instance Attribute Details
#headers ⇒ Object
Returns the value of attribute headers.
6 7 8 |
# File 'lib/greenlight/injector.rb', line 6 def headers @headers end |
Class Method Details
.decorate(options) ⇒ Object
20 21 22 23 24 |
# File 'lib/greenlight/injector.rb', line 20 def self.decorate() [:headers] = {} unless (.key?(:headers) && [:headers].is_a?(Hash)) [:headers].merge!(Injector.instance.headers) end |
Instance Method Details
#add_header(header, value) ⇒ Object
12 13 14 |
# File 'lib/greenlight/injector.rb', line 12 def add_header(header, value) self.headers[header] = value end |
#rm_header(header) ⇒ Object
16 17 18 |
# File 'lib/greenlight/injector.rb', line 16 def rm_header(header) self.headers.delete(header) end |