Class: Yeller::Configuration
- Inherits:
-
Object
- Object
- Yeller::Configuration
- 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), ]
- DEFAULT_SKIPPED_EXCEPTIONS =
[ 'AbstractController::ActionNotFound', 'ActionController::InvalidAuthenticityToken', 'ActionController::RoutingError', 'ActionController::UnknownAction', 'ActiveRecord::RecordNotFound', 'CGI::Session::CookieStore::TamperedWithCookie', 'Mongoid::Errors::DocumentNotFound', 'Sinatra::NotFound' ]
Instance Attribute Summary collapse
-
#development_environments ⇒ Object
Returns the value of attribute development_environments.
-
#error_handler ⇒ Object
Returns the value of attribute error_handler.
-
#project_root ⇒ Object
Returns the value of attribute project_root.
-
#servers ⇒ Object
readonly
Returns the value of attribute servers.
-
#startup_params ⇒ Object
readonly
Returns the value of attribute startup_params.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #add_insecure_server(host, port = 80) ⇒ Object
- #add_server(host, port = 443) ⇒ Object
- #add_skip_exceptions(skip_exceptions) ⇒ Object
- #backtrace_filename_filters ⇒ Object
- #backtrace_method_filters ⇒ Object
- #environment=(new_environment) ⇒ Object
- #host=(new_host) ⇒ Object
- #ignore_exceptions? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #remove_default_servers ⇒ Object
- #skip_exceptions ⇒ Object
- #skip_exceptions=(skip_exceptions) ⇒ Object
- #skip_exceptions_callback(skip_exceptions_callback) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
26 27 28 29 30 31 32 |
# File 'lib/yeller/configuration.rb', line 26 def initialize @servers = DEFAULT_SERVERS @startup_params = {} @error_handler = Yeller::LogErrorHandler.new @development_environments = Set.new(['development', 'test']) @skip_exceptions = DEFAULT_SKIPPED_EXCEPTIONS end |
Instance Attribute Details
#development_environments ⇒ Object
Returns the value of attribute development_environments.
6 7 8 |
# File 'lib/yeller/configuration.rb', line 6 def development_environments @development_environments end |
#error_handler ⇒ Object
Returns the value of attribute error_handler.
6 7 8 |
# File 'lib/yeller/configuration.rb', line 6 def error_handler @error_handler end |
#project_root ⇒ Object
Returns the value of attribute project_root.
6 7 8 |
# File 'lib/yeller/configuration.rb', line 6 def project_root @project_root end |
#servers ⇒ Object (readonly)
Returns the value of attribute servers.
6 7 8 |
# File 'lib/yeller/configuration.rb', line 6 def servers @servers end |
#startup_params ⇒ Object (readonly)
Returns the value of attribute startup_params.
6 7 8 |
# File 'lib/yeller/configuration.rb', line 6 def startup_params @startup_params end |
#token ⇒ Object
Returns the value of attribute token.
6 7 8 |
# File 'lib/yeller/configuration.rb', line 6 def token @token end |
Instance Method Details
#add_insecure_server(host, port = 80) ⇒ Object
44 45 46 |
# File 'lib/yeller/configuration.rb', line 44 def add_insecure_server(host, port=80) @servers << Yeller::Server.new(host, port) end |
#add_server(host, port = 443) ⇒ Object
39 40 41 42 |
# File 'lib/yeller/configuration.rb', line 39 def add_server(host, port=443) @servers << Yeller::SecureServer.new(host, port) self end |
#add_skip_exceptions(skip_exceptions) ⇒ Object
128 129 130 131 |
# File 'lib/yeller/configuration.rb', line 128 def add_skip_exceptions(skip_exceptions) @skip_exceptions ||= [] @skip_exceptions = @skip_exceptions + skip_exceptions end |
#backtrace_filename_filters ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/yeller/configuration.rb', line 48 def backtrace_filename_filters filters = Set.new([]) 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_filters ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/yeller/configuration.rb', line 63 def backtrace_method_filters filters = [] if defined?(Rails) filters << [/_run__\d+__.*callbacks/, 'process_callbacks'] end filters end |
#environment=(new_environment) ⇒ Object
71 72 73 |
# File 'lib/yeller/configuration.rb', line 71 def environment=(new_environment) @startup_params[:"application-environment"] = new_environment end |
#host=(new_host) ⇒ Object
75 76 77 |
# File 'lib/yeller/configuration.rb', line 75 def host=(new_host) @startup_params[:host] = new_host end |
#ignore_exceptions? ⇒ Boolean
100 101 102 103 |
# File 'lib/yeller/configuration.rb', line 100 def ignore_exceptions? development_environments.include?( @startup_params[:"application-environment"]) end |
#remove_default_servers ⇒ Object
34 35 36 37 |
# File 'lib/yeller/configuration.rb', line 34 def remove_default_servers @servers = [] self end |
#skip_exceptions ⇒ Object
117 118 119 120 121 122 |
# File 'lib/yeller/configuration.rb', line 117 def skip_exceptions Yeller::SkipExceptions.new( @skip_exceptions || [], @skip_exceptions_callback || Proc.new {|e| false} ) end |
#skip_exceptions=(skip_exceptions) ⇒ Object
124 125 126 |
# File 'lib/yeller/configuration.rb', line 124 def skip_exceptions=(skip_exceptions) @skip_exceptions = skip_exceptions end |
#skip_exceptions_callback(skip_exceptions_callback) ⇒ Object
133 134 135 |
# File 'lib/yeller/configuration.rb', line 133 def skip_exceptions_callback(skip_exceptions_callback) @skip_exceptions_callback = skip_exceptions_callback end |