class EventHub::Configuration
Attributes
data[RW]
environment[RW]
folder[RW]
Public Class Methods
new()
click to toggle source
# File lib/eventhub/configuration.rb, line 9 def initialize @data = {} @environment = 'development' end
Public Instance Methods
load_file(input, env = 'development')
click to toggle source
# File lib/eventhub/configuration.rb, line 14 def load_file(input, env = 'development') load_string(IO.read(input), env) true rescue => e EventHub.logger.info("Unexpected exception while loading configuration [#{input}]: #{format_string(e.message)}") false end
load_string(json_string, env = 'development')
click to toggle source
# File lib/eventhub/configuration.rb, line 22 def load_string(json_string, env = 'development') json = JSON.parse(json_string) @data = json[env] @environment = env true rescue => e EventHub.logger.info("JSON configuration parsing failed: #{format_string(e.message)}") false end