Class: Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_path) ⇒ Config

Returns a new instance of Config.



36
37
38
39
40
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
# File 'lib/debugtrace/config.rb', line 36

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)'
  @count_format              = get_value 'count_format'             , 'count:%d'
  @minimum_output_count      = get_value 'minimum_output_count'     , 16
  @length_format             = get_value 'length_format'            , 'length:%d'
  @minimum_output_length     = get_value 'minimum_output_length'    , 16
  @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_lineObject (readonly)

Returns the value of attribute bytes_count_in_line.



30
31
32
# File 'lib/debugtrace/config.rb', line 30

def bytes_count_in_line
  @bytes_count_in_line
end

#bytes_limitObject (readonly)

Returns the value of attribute bytes_limit.



32
33
34
# File 'lib/debugtrace/config.rb', line 32

def bytes_limit
  @bytes_limit
end

#collection_limitObject (readonly)

Returns the value of attribute collection_limit.



31
32
33
# File 'lib/debugtrace/config.rb', line 31

def collection_limit
  @collection_limit
end

#configObject (readonly)

Returns the value of attribute config.



7
8
9
# File 'lib/debugtrace/config.rb', line 7

def config
  @config
end

#config_pathObject (readonly)

Returns the value of attribute config_path.



8
9
10
# File 'lib/debugtrace/config.rb', line 8

def config_path
  @config_path
end

#count_formatObject (readonly)

Returns the value of attribute count_format.



25
26
27
# File 'lib/debugtrace/config.rb', line 25

def count_format
  @count_format
end

#cyclic_reference_stringObject (readonly)

Returns the value of attribute cyclic_reference_string.



21
22
23
# File 'lib/debugtrace/config.rb', line 21

def cyclic_reference_string
  @cyclic_reference_string
end

#data_indent_stringObject (readonly)

Returns the value of attribute data_indent_string.



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

def data_indent_string
  @data_indent_string
end

#enter_formatObject (readonly)

Returns the value of attribute enter_format.



13
14
15
# File 'lib/debugtrace/config.rb', line 13

def enter_format
  @enter_format
end

#indent_stringObject (readonly)

Returns the value of attribute indent_string.



17
18
19
# File 'lib/debugtrace/config.rb', line 17

def indent_string
  @indent_string
end

#key_value_separatorObject (readonly)

Returns the value of attribute key_value_separator.



23
24
25
# File 'lib/debugtrace/config.rb', line 23

def key_value_separator
  @key_value_separator
end

#leave_formatObject (readonly)

Returns the value of attribute leave_format.



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

def leave_format
  @leave_format
end

#length_formatObject (readonly)

Returns the value of attribute length_format.



27
28
29
# File 'lib/debugtrace/config.rb', line 27

def length_format
  @length_format
end

#limit_stringObject (readonly)

Returns the value of attribute limit_string.



19
20
21
# File 'lib/debugtrace/config.rb', line 19

def limit_string
  @limit_string
end

#log_pathObject (readonly)

Returns the value of attribute log_path.



10
11
12
# File 'lib/debugtrace/config.rb', line 10

def log_path
  @log_path
end

#logger_nameObject (readonly)

Returns the value of attribute logger_name.



9
10
11
# File 'lib/debugtrace/config.rb', line 9

def logger_name
  @logger_name
end

#logging_datetime_formatObject (readonly)

Returns the value of attribute logging_datetime_format.



12
13
14
# File 'lib/debugtrace/config.rb', line 12

def logging_datetime_format
  @logging_datetime_format
end

#logging_formatObject (readonly)

Returns the value of attribute logging_format.



11
12
13
# File 'lib/debugtrace/config.rb', line 11

def logging_format
  @logging_format
end

#maximum_data_output_widthObject (readonly)

Returns the value of attribute maximum_data_output_width.



29
30
31
# File 'lib/debugtrace/config.rb', line 29

def maximum_data_output_width
  @maximum_data_output_width
end

#maximum_indentsObject (readonly)

Returns the value of attribute maximum_indents.



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

def maximum_indents
  @maximum_indents
end

#minimum_output_countObject (readonly)

Returns the value of attribute minimum_output_count.



26
27
28
# File 'lib/debugtrace/config.rb', line 26

def minimum_output_count
  @minimum_output_count
end

#minimum_output_lengthObject (readonly)

Returns the value of attribute minimum_output_length.



28
29
30
# File 'lib/debugtrace/config.rb', line 28

def minimum_output_length
  @minimum_output_length
end

#non_output_stringObject (readonly)

Returns the value of attribute non_output_string.



20
21
22
# File 'lib/debugtrace/config.rb', line 20

def non_output_string
  @non_output_string
end

Returns the value of attribute print_suffix_format.



24
25
26
# File 'lib/debugtrace/config.rb', line 24

def print_suffix_format
  @print_suffix_format
end

#reflection_limitObject (readonly)

Returns the value of attribute reflection_limit.



34
35
36
# File 'lib/debugtrace/config.rb', line 34

def reflection_limit
  @reflection_limit
end

#string_limitObject (readonly)

Returns the value of attribute string_limit.



33
34
35
# File 'lib/debugtrace/config.rb', line 33

def string_limit
  @string_limit
end

#thread_boundary_formatObject (readonly)

Returns the value of attribute thread_boundary_format.



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

def thread_boundary_format
  @thread_boundary_format
end

#varname_value_separatorObject (readonly)

Returns the value of attribute varname_value_separator.



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

def varname_value_separator
  @varname_value_separator
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


73
# File 'lib/debugtrace/config.rb', line 73

def enabled? = @enabled