Class: Hackle::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/hackle/config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Config

Returns a new instance of Config.



8
9
10
11
12
# File 'lib/hackle/config.rb', line 8

def initialize(options = {})
  @logger = options[:logger] || Config.default_logger
  @base_uri = options[:base_uri] || Config.default_base_uri
  @event_uri = options[:event_uri] || Config.default_event_uri
end

Instance Attribute Details

#base_uriObject (readonly)

Returns the value of attribute base_uri.



15
16
17
# File 'lib/hackle/config.rb', line 15

def base_uri
  @base_uri
end

#event_uriObject (readonly)

Returns the value of attribute event_uri.



16
17
18
# File 'lib/hackle/config.rb', line 16

def event_uri
  @event_uri
end

#loggerObject (readonly)

Returns the value of attribute logger.



14
15
16
# File 'lib/hackle/config.rb', line 14

def logger
  @logger
end

Class Method Details

.default_base_uriObject



18
19
20
# File 'lib/hackle/config.rb', line 18

def self.default_base_uri
  'https://sdk.hackle.io'
end

.default_event_uriObject



22
23
24
# File 'lib/hackle/config.rb', line 22

def self.default_event_uri
  'https://event.hackle.io'
end

.default_loggerObject



26
27
28
29
30
31
32
# File 'lib/hackle/config.rb', line 26

def self.default_logger
  if defined?(Rails) && Rails.logger
    Rails.logger
  else
    Logger.new($stdout)
  end
end