Class: Unleash::Bootstrap::Handler
- Inherits:
-
Object
- Object
- Unleash::Bootstrap::Handler
- Defined in:
- lib/unleash/bootstrap/handler.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
Returns the value of attribute configuration.
Instance Method Summary collapse
-
#initialize(configuration) ⇒ Handler
constructor
A new instance of Handler.
-
#retrieve_toggles ⇒ String
JSON string representing data returned from an Unleash server.
Constructor Details
#initialize(configuration) ⇒ Handler
Returns a new instance of Handler.
9 10 11 |
# File 'lib/unleash/bootstrap/handler.rb', line 9 def initialize(configuration) self.configuration = configuration end |
Instance Attribute Details
#configuration ⇒ Object
Returns the value of attribute configuration.
7 8 9 |
# File 'lib/unleash/bootstrap/handler.rb', line 7 def configuration @configuration end |
Instance Method Details
#retrieve_toggles ⇒ String
Returns JSON string representing data returned from an Unleash server.
14 15 16 17 18 19 |
# File 'lib/unleash/bootstrap/handler.rb', line 14 def retrieve_toggles return configuration.data unless self.configuration.data.nil? return configuration.block.call if self.configuration.block.is_a?(Proc) return Provider::FromFile.read(configuration.file_path) unless self.configuration.file_path.nil? return Provider::FromUrl.read(configuration.url, configuration.url_headers) unless self.configuration.url.nil? end |