Class: CloudGovConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env = ENV["VCAP_SERVICES"]) ⇒ CloudGovConfig

Returns a new instance of CloudGovConfig.



6
7
8
# File 'lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb', line 6

def initialize(env = ENV["VCAP_SERVICES"])
  @vcap_services = env.blank? ? {} : JSON.parse(env).with_indifferent_access
end

Instance Attribute Details

#vcap_servicesObject (readonly)

Returns the value of attribute vcap_services.



4
5
6
# File 'lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb', line 4

def vcap_services
  @vcap_services
end

Instance Method Details

#dig(*path) ⇒ Object



10
11
12
13
# File 'lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb', line 10

def dig(*path)
  first, *rest = path
  vcap_services[first]&.first&.dig(*rest)
end