Class: Config
- Inherits:
-
Object
- Object
- Config
- Defined in:
- lib/debugtrace/config.rb
Overview
Retains the contents defined in debugtrace.yml.
Instance Attribute Summary collapse
-
#bytes_count_in_line ⇒ Object
readonly
Returns the value of attribute bytes_count_in_line.
-
#bytes_limit ⇒ Object
readonly
Returns the value of attribute bytes_limit.
-
#collection_limit ⇒ Object
readonly
Returns the value of attribute collection_limit.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#config_path ⇒ Object
readonly
Returns the value of attribute config_path.
-
#cyclic_reference_string ⇒ Object
readonly
Returns the value of attribute cyclic_reference_string.
-
#data_indent_string ⇒ Object
readonly
Returns the value of attribute data_indent_string.
-
#enter_format ⇒ Object
readonly
Returns the value of attribute enter_format.
-
#indent_string ⇒ Object
readonly
Returns the value of attribute indent_string.
-
#key_value_separator ⇒ Object
readonly
Returns the value of attribute key_value_separator.
-
#leave_format ⇒ Object
readonly
Returns the value of attribute leave_format.
-
#length_format ⇒ Object
readonly
Returns the value of attribute length_format.
-
#limit_string ⇒ Object
readonly
Returns the value of attribute limit_string.
-
#log_path ⇒ Object
readonly
Returns the value of attribute log_path.
-
#logger_name ⇒ Object
readonly
Returns the value of attribute logger_name.
-
#logging_datetime_format ⇒ Object
readonly
Returns the value of attribute logging_datetime_format.
-
#logging_format ⇒ Object
readonly
Returns the value of attribute logging_format.
-
#maximum_data_output_width ⇒ Object
readonly
Returns the value of attribute maximum_data_output_width.
-
#maximum_indents ⇒ Object
readonly
Returns the value of attribute maximum_indents.
-
#minimum_output_length ⇒ Object
readonly
Returns the value of attribute minimum_output_length.
-
#minimum_output_size ⇒ Object
readonly
Returns the value of attribute minimum_output_size.
-
#non_output_string ⇒ Object
readonly
Returns the value of attribute non_output_string.
-
#print_suffix_format ⇒ Object
readonly
Returns the value of attribute print_suffix_format.
-
#reflection_limit ⇒ Object
readonly
Returns the value of attribute reflection_limit.
-
#size_format ⇒ Object
readonly
Returns the value of attribute size_format.
-
#string_limit ⇒ Object
readonly
Returns the value of attribute string_limit.
-
#thread_boundary_format ⇒ Object
readonly
Returns the value of attribute thread_boundary_format.
-
#varname_value_separator ⇒ Object
readonly
Returns the value of attribute varname_value_separator.
Instance Method Summary collapse
-
#enabled? ⇒ TrueClass, FalseClass
Returns true if logging is enabled, false otherwise.
-
#initialize(config_path) ⇒ Config
constructor
Initializes with a yml file in the config_path.
Constructor Details
#initialize(config_path) ⇒ Config
Initializes with a yml file in the config_path.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/debugtrace/config.rb', line 41 def initialize(config_path) @config_path = Common.check_type('config_path', config_path, String) if File.exist?(@config_path) @config = YAML.load_file(@config_path) else @config_path = '<No config file>' @config = nil end @logger_name = get_value 'logger' , 'stderr' @log_path = get_value 'log_path' , 'debugtrace.log' @logging_format = get_value 'logging_format' , "%2$s %1$s %4$s\n" @logging_datetime_format = get_value 'logging_datetime_format' , '%Y-%m-%d %H:%M:%S.%L%:z' @enabled = get_value 'enabled' , true @enter_format = get_value 'enter_format' , 'Enter %1$s (%2$s:%3$d) <- %4$s (%5$s:%6$d)' @leave_format = get_value 'leave_format' , 'Leave %1$s (%2$s:%3$d) duration: %4$.3f ms' @thread_boundary_format = get_value 'thread_boundary_format' , '______________________________ %1$s #%2$s ______________________________' @maximum_indents = get_value 'maximum_indents' , 32 @indent_string = get_value 'indent_string' , '| ' @data_indent_string = get_value 'data_indent_string' , ' ' @limit_string = get_value 'limit_string' , '...' @non_output_string = get_value 'non_output_string' , '...' @cyclic_reference_string = get_value 'cyclic_reference_string' , '*** Cyclic Reference ***' @varname_value_separator = get_value 'varname_value_separator' , ' = ' @key_value_separator = get_value 'key_value_separator' , ': ' @print_suffix_format = get_value 'print_suffix_format' , ' (%2$s:%3$d)' @size_format = get_value 'size_format' , '(size:%d)' @minimum_output_size = get_value 'minimum_output_size' , 256 @length_format = get_value 'length_format' , '(length:%d)' @minimum_output_length = get_value 'minimum_output_length' , 256 @maximum_data_output_width = get_value 'maximum_data_output_width', 70 @bytes_count_in_line = get_value 'bytes_count_in_line' , 16 @collection_limit = get_value 'collection_limit' , 128 @bytes_limit = get_value 'bytes_limit' , 256 @string_limit = get_value 'string_limit' , 256 @reflection_limit = get_value 'reflection_limit' , 4 end |
Instance Attribute Details
#bytes_count_in_line ⇒ Object (readonly)
Returns the value of attribute bytes_count_in_line.
32 33 34 |
# File 'lib/debugtrace/config.rb', line 32 def bytes_count_in_line @bytes_count_in_line end |
#bytes_limit ⇒ Object (readonly)
Returns the value of attribute bytes_limit.
34 35 36 |
# File 'lib/debugtrace/config.rb', line 34 def bytes_limit @bytes_limit end |
#collection_limit ⇒ Object (readonly)
Returns the value of attribute collection_limit.
33 34 35 |
# File 'lib/debugtrace/config.rb', line 33 def collection_limit @collection_limit end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/debugtrace/config.rb', line 10 def config @config end |
#config_path ⇒ Object (readonly)
Returns the value of attribute config_path.
9 10 11 |
# File 'lib/debugtrace/config.rb', line 9 def config_path @config_path end |
#cyclic_reference_string ⇒ Object (readonly)
Returns the value of attribute cyclic_reference_string.
23 24 25 |
# File 'lib/debugtrace/config.rb', line 23 def cyclic_reference_string @cyclic_reference_string end |
#data_indent_string ⇒ Object (readonly)
Returns the value of attribute data_indent_string.
20 21 22 |
# File 'lib/debugtrace/config.rb', line 20 def data_indent_string @data_indent_string end |
#enter_format ⇒ Object (readonly)
Returns the value of attribute enter_format.
15 16 17 |
# File 'lib/debugtrace/config.rb', line 15 def enter_format @enter_format end |
#indent_string ⇒ Object (readonly)
Returns the value of attribute indent_string.
19 20 21 |
# File 'lib/debugtrace/config.rb', line 19 def indent_string @indent_string end |
#key_value_separator ⇒ Object (readonly)
Returns the value of attribute key_value_separator.
25 26 27 |
# File 'lib/debugtrace/config.rb', line 25 def key_value_separator @key_value_separator end |
#leave_format ⇒ Object (readonly)
Returns the value of attribute leave_format.
16 17 18 |
# File 'lib/debugtrace/config.rb', line 16 def leave_format @leave_format end |
#length_format ⇒ Object (readonly)
Returns the value of attribute length_format.
29 30 31 |
# File 'lib/debugtrace/config.rb', line 29 def length_format @length_format end |
#limit_string ⇒ Object (readonly)
Returns the value of attribute limit_string.
21 22 23 |
# File 'lib/debugtrace/config.rb', line 21 def limit_string @limit_string end |
#log_path ⇒ Object (readonly)
Returns the value of attribute log_path.
12 13 14 |
# File 'lib/debugtrace/config.rb', line 12 def log_path @log_path end |
#logger_name ⇒ Object (readonly)
Returns the value of attribute logger_name.
11 12 13 |
# File 'lib/debugtrace/config.rb', line 11 def logger_name @logger_name end |
#logging_datetime_format ⇒ Object (readonly)
Returns the value of attribute logging_datetime_format.
14 15 16 |
# File 'lib/debugtrace/config.rb', line 14 def logging_datetime_format @logging_datetime_format end |
#logging_format ⇒ Object (readonly)
Returns the value of attribute logging_format.
13 14 15 |
# File 'lib/debugtrace/config.rb', line 13 def logging_format @logging_format end |
#maximum_data_output_width ⇒ Object (readonly)
Returns the value of attribute maximum_data_output_width.
31 32 33 |
# File 'lib/debugtrace/config.rb', line 31 def maximum_data_output_width @maximum_data_output_width end |
#maximum_indents ⇒ Object (readonly)
Returns the value of attribute maximum_indents.
18 19 20 |
# File 'lib/debugtrace/config.rb', line 18 def maximum_indents @maximum_indents end |
#minimum_output_length ⇒ Object (readonly)
Returns the value of attribute minimum_output_length.
30 31 32 |
# File 'lib/debugtrace/config.rb', line 30 def minimum_output_length @minimum_output_length end |
#minimum_output_size ⇒ Object (readonly)
Returns the value of attribute minimum_output_size.
28 29 30 |
# File 'lib/debugtrace/config.rb', line 28 def minimum_output_size @minimum_output_size end |
#non_output_string ⇒ Object (readonly)
Returns the value of attribute non_output_string.
22 23 24 |
# File 'lib/debugtrace/config.rb', line 22 def non_output_string @non_output_string end |
#print_suffix_format ⇒ Object (readonly)
Returns the value of attribute print_suffix_format.
26 27 28 |
# File 'lib/debugtrace/config.rb', line 26 def print_suffix_format @print_suffix_format end |
#reflection_limit ⇒ Object (readonly)
Returns the value of attribute reflection_limit.
36 37 38 |
# File 'lib/debugtrace/config.rb', line 36 def reflection_limit @reflection_limit end |
#size_format ⇒ Object (readonly)
Returns the value of attribute size_format.
27 28 29 |
# File 'lib/debugtrace/config.rb', line 27 def size_format @size_format end |
#string_limit ⇒ Object (readonly)
Returns the value of attribute string_limit.
35 36 37 |
# File 'lib/debugtrace/config.rb', line 35 def string_limit @string_limit end |
#thread_boundary_format ⇒ Object (readonly)
Returns the value of attribute thread_boundary_format.
17 18 19 |
# File 'lib/debugtrace/config.rb', line 17 def thread_boundary_format @thread_boundary_format end |
#varname_value_separator ⇒ Object (readonly)
Returns the value of attribute varname_value_separator.
24 25 26 |
# File 'lib/debugtrace/config.rb', line 24 def varname_value_separator @varname_value_separator end |
Instance Method Details
#enabled? ⇒ TrueClass, FalseClass
Returns true if logging is enabled, false otherwise.
81 82 83 |
# File 'lib/debugtrace/config.rb', line 81 def enabled? return @enabled end |