Class: Yeller::Configuration

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

Constant Summary collapse

DEFAULT_SERVERS =
[
  Yeller::SecureServer.new("collector1.yellerapp.com", 443),
  Yeller::SecureServer.new("collector2.yellerapp.com", 443),
  Yeller::SecureServer.new("collector3.yellerapp.com", 443),
  Yeller::SecureServer.new("collector4.yellerapp.com", 443),
  Yeller::SecureServer.new("collector5.yellerapp.com", 443),
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



14
15
16
17
18
19
# File 'lib/yeller/configuration.rb', line 14

def initialize
  @servers = DEFAULT_SERVERS
  @startup_params = {}
  @error_handler = Yeller::LogErrorHandler.new
  @development_environments = Set.new(['development', 'test'])
end

Instance Attribute Details

#development_environmentsObject

Returns the value of attribute development_environments.



5
6
7
# File 'lib/yeller/configuration.rb', line 5

def development_environments
  @development_environments
end

#error_handlerObject

Returns the value of attribute error_handler.



5
6
7
# File 'lib/yeller/configuration.rb', line 5

def error_handler
  @error_handler
end

#project_rootObject

Returns the value of attribute project_root.



5
6
7
# File 'lib/yeller/configuration.rb', line 5

def project_root
  @project_root
end

#serversObject (readonly)

Returns the value of attribute servers.



5
6
7
# File 'lib/yeller/configuration.rb', line 5

def servers
  @servers
end

#startup_paramsObject (readonly)

Returns the value of attribute startup_params.



5
6
7
# File 'lib/yeller/configuration.rb', line 5

def startup_params
  @startup_params
end

#tokenObject

Returns the value of attribute token.



5
6
7
# File 'lib/yeller/configuration.rb', line 5

def token
  @token
end

Instance Method Details

#add_insecure_server(host, port = 80) ⇒ Object



31
32
33
# File 'lib/yeller/configuration.rb', line 31

def add_insecure_server(host, port=80)
  @servers << Yeller::Server.new(host, port)
end

#add_server(host, port = 443) ⇒ Object



26
27
28
29
# File 'lib/yeller/configuration.rb', line 26

def add_server(host, port=443)
  @servers << Yeller::SecureServer.new(host, port)
  self
end

#backtrace_filename_filtersObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/yeller/configuration.rb', line 35

def backtrace_filename_filters
  filters = []
  if defined?(Gem)
    Gem.path.each do |gem_path|
      if 0 < gem_path.size
        filters << [gem_path, 'GEM_ROOT']
      end
    end
  end
  if 0 < project_root.size
    filters << [project_root, 'PROJECT_ROOT']
  end
  filters
end

#backtrace_method_filtersObject



50
51
52
53
54
55
56
# File 'lib/yeller/configuration.rb', line 50

def backtrace_method_filters
  filters = []
  if defined?(Rails)
    filters << [/_run__\d+__.*callbacks/, 'process_callbacks']
  end
  filters
end

#environment=(new_environment) ⇒ Object



58
59
60
# File 'lib/yeller/configuration.rb', line 58

def environment=(new_environment)
  @startup_params[:"application-environment"] = new_environment
end

#host=(new_host) ⇒ Object



62
63
64
# File 'lib/yeller/configuration.rb', line 62

def host=(new_host)
  @startup_params[:host] = new_host
end

#ignore_exceptions?Boolean

Returns:

  • (Boolean)


87
88
89
90
# File 'lib/yeller/configuration.rb', line 87

def ignore_exceptions?
  development_environments.include?(
    @startup_params[:"application-environment"])
end

#remove_default_serversObject



21
22
23
24
# File 'lib/yeller/configuration.rb', line 21

def remove_default_servers
  @servers = []
  self
end