Class: Greenlight::Runner
- Inherits:
-
Object
- Object
- Greenlight::Runner
- Includes:
- Singleton
- Defined in:
- lib/greenlight.rb
Constant Summary collapse
- ATLAS_ENV_PREFIX =
'greenlight'
- ATLAS_ENV_SEPARATOR =
'_'
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
- #add_header(header, value) ⇒ Object
- #add_headers(headers) ⇒ Object
-
#initialize ⇒ Runner
constructor
A new instance of Runner.
- #load_data(uri, overwrite = false) ⇒ Object
- #rm_header(header) ⇒ Object
- #scenario(name, &block) ⇒ Object
- #test(name, &block) ⇒ Object
Constructor Details
#initialize ⇒ Runner
Returns a new instance of Runner.
89 90 91 92 |
# File 'lib/greenlight.rb', line 89 def initialize self.params = {} self.data = {} end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
14 15 16 |
# File 'lib/greenlight.rb', line 14 def data @data end |
#params ⇒ Object
Returns the value of attribute params.
14 15 16 |
# File 'lib/greenlight.rb', line 14 def params @params end |
Instance Method Details
#add_header(header, value) ⇒ Object
120 121 122 |
# File 'lib/greenlight.rb', line 120 def add_header(header, value) Injector.instance.add_header(header, value) end |
#add_headers(headers) ⇒ Object
128 129 130 131 132 |
# File 'lib/greenlight.rb', line 128 def add_headers(headers) headers.each do |key, val| Injector.instance.add_header(key, val) end end |
#load_data(uri, overwrite = false) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/greenlight.rb', line 94 def load_data(uri, overwrite = false) info "loading data from #{uri}" if uri.start_with?('http://', 'https://') new_data = load_data_url(uri) else new_data = load_data_file(uri) end if overwrite self.data = new_data else self.data.merge!(new_data) end load_env new_data end |
#rm_header(header) ⇒ Object
124 125 126 |
# File 'lib/greenlight.rb', line 124 def rm_header(header) Injector.instance.rm_header(header) end |