Class: Unleash::Bootstrap::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/unleash/bootstrap/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Configuration

Returns a new instance of Configuration.



6
7
8
9
10
11
12
# File 'lib/unleash/bootstrap/configuration.rb', line 6

def initialize(opts = {})
  self.file_path = resolve_value_indifferently(opts, 'file_path') || ENV['UNLEASH_BOOTSTRAP_FILE'] || nil
  self.url = resolve_value_indifferently(opts, 'url') || ENV['UNLEASH_BOOTSTRAP_URL'] || nil
  self.url_headers = resolve_value_indifferently(opts, 'url_headers')
  self.data = resolve_value_indifferently(opts, 'data')
  self.block = resolve_value_indifferently(opts, 'block')
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



4
5
6
# File 'lib/unleash/bootstrap/configuration.rb', line 4

def block
  @block
end

#dataObject

Returns the value of attribute data.



4
5
6
# File 'lib/unleash/bootstrap/configuration.rb', line 4

def data
  @data
end

#file_pathObject

Returns the value of attribute file_path.



4
5
6
# File 'lib/unleash/bootstrap/configuration.rb', line 4

def file_path
  @file_path
end

#urlObject

Returns the value of attribute url.



4
5
6
# File 'lib/unleash/bootstrap/configuration.rb', line 4

def url
  @url
end

#url_headersObject

Returns the value of attribute url_headers.



4
5
6
# File 'lib/unleash/bootstrap/configuration.rb', line 4

def url_headers
  @url_headers
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/unleash/bootstrap/configuration.rb', line 14

def valid?
  ![self.data, self.file_path, self.url, self.block].all?(&:nil?)
end