Class: Rack::DevInsight::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rack/dev_insight/config.rb', line 17

def initialize
  @storage_type = :memory
  @memory_store_size = 32 * 1024 * 1024
  @file_store_pool_size = 100
  @file_store_dir_path = 'tmp/rack-dev_insight'
  @skip_paths = []
  @backtrace_depth = 5
  @backtrace_exclusion_patterns = [%r{/gems/}]
  @prepared_statement_limit = 1000
  @skip_cached_sql = true
end

Instance Attribute Details

#backtrace_depthObject

Returns the value of attribute backtrace_depth.



6
7
8
# File 'lib/rack/dev_insight/config.rb', line 6

def backtrace_depth
  @backtrace_depth
end

#backtrace_exclusion_patternsObject

Returns the value of attribute backtrace_exclusion_patterns.



6
7
8
# File 'lib/rack/dev_insight/config.rb', line 6

def backtrace_exclusion_patterns
  @backtrace_exclusion_patterns
end

#detected_dialectObject

Returns the value of attribute detected_dialect.



6
7
8
# File 'lib/rack/dev_insight/config.rb', line 6

def detected_dialect
  @detected_dialect
end

#file_store_dir_pathObject

Returns the value of attribute file_store_dir_path.



6
7
8
# File 'lib/rack/dev_insight/config.rb', line 6

def file_store_dir_path
  @file_store_dir_path
end

#file_store_pool_sizeObject

Returns the value of attribute file_store_pool_size.



6
7
8
# File 'lib/rack/dev_insight/config.rb', line 6

def file_store_pool_size
  @file_store_pool_size
end

#memory_store_sizeObject

Returns the value of attribute memory_store_size.



6
7
8
# File 'lib/rack/dev_insight/config.rb', line 6

def memory_store_size
  @memory_store_size
end

#prepared_statement_limitObject

Returns the value of attribute prepared_statement_limit.



6
7
8
# File 'lib/rack/dev_insight/config.rb', line 6

def prepared_statement_limit
  @prepared_statement_limit
end

#skip_cached_sqlObject

Returns the value of attribute skip_cached_sql.



6
7
8
# File 'lib/rack/dev_insight/config.rb', line 6

def skip_cached_sql
  @skip_cached_sql
end

#skip_pathsObject

Returns the value of attribute skip_paths.



6
7
8
# File 'lib/rack/dev_insight/config.rb', line 6

def skip_paths
  @skip_paths
end

#storage_typeObject

Returns the value of attribute storage_type.



6
7
8
# File 'lib/rack/dev_insight/config.rb', line 6

def storage_type
  @storage_type
end

Instance Method Details

#storage_instanceObject



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rack/dev_insight/config.rb', line 29

def storage_instance
  case storage_type.to_sym
  when :memory
    MemoryStore.new
  when :file
    FileStore.new
  else
    warn "warning: Unknown storage type: #{storage_type} in Rack::DevInsight::Config. " \
           'Available types are :memory and :file. Falling back to :memory.'
    MemoryStore.new
  end
end