ruby_jard 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +3 -0
  3. data/.github/workflows/documentation.yml +65 -0
  4. data/.github/workflows/{ruby.yml → rspec.yml} +22 -11
  5. data/.rubocop.yml +6 -0
  6. data/CHANGELOG.md +15 -3
  7. data/Gemfile +9 -2
  8. data/README.md +52 -332
  9. data/benchmark/path_filter_bench.rb +58 -0
  10. data/lib/ruby_jard.rb +15 -5
  11. data/lib/ruby_jard/color_schemes.rb +9 -1
  12. data/lib/ruby_jard/color_schemes/256_color_scheme.rb +21 -35
  13. data/lib/ruby_jard/color_schemes/256_light_color_scheme.rb +23 -35
  14. data/lib/ruby_jard/color_schemes/deep_space_color_scheme.rb +20 -34
  15. data/lib/ruby_jard/color_schemes/gruvbox_color_scheme.rb +20 -34
  16. data/lib/ruby_jard/color_schemes/one_half_dark_color_scheme.rb +20 -34
  17. data/lib/ruby_jard/color_schemes/one_half_light_color_scheme.rb +21 -34
  18. data/lib/ruby_jard/commands/color_helpers.rb +32 -0
  19. data/lib/ruby_jard/commands/frame_command.rb +2 -2
  20. data/lib/ruby_jard/commands/jard/color_scheme_command.rb +25 -3
  21. data/lib/ruby_jard/commands/jard/filter_command.rb +136 -0
  22. data/lib/ruby_jard/commands/jard/output_command.rb +13 -5
  23. data/lib/ruby_jard/commands/jard_command.rb +3 -1
  24. data/lib/ruby_jard/config.rb +9 -2
  25. data/lib/ruby_jard/decorators/array_decorator.rb +79 -0
  26. data/lib/ruby_jard/decorators/attributes_decorator.rb +172 -0
  27. data/lib/ruby_jard/decorators/color_decorator.rb +12 -5
  28. data/lib/ruby_jard/decorators/hash_decorator.rb +74 -0
  29. data/lib/ruby_jard/decorators/inspection_decorator.rb +91 -58
  30. data/lib/ruby_jard/decorators/object_decorator.rb +122 -0
  31. data/lib/ruby_jard/decorators/path_decorator.rb +55 -72
  32. data/lib/ruby_jard/decorators/rails_decorator.rb +194 -0
  33. data/lib/ruby_jard/decorators/string_decorator.rb +41 -0
  34. data/lib/ruby_jard/decorators/struct_decorator.rb +79 -0
  35. data/lib/ruby_jard/frame.rb +23 -10
  36. data/lib/ruby_jard/keys.rb +1 -0
  37. data/lib/ruby_jard/layouts/narrow_horizontal_layout.rb +4 -0
  38. data/lib/ruby_jard/layouts/tiny_layout.rb +4 -0
  39. data/lib/ruby_jard/pager.rb +21 -5
  40. data/lib/ruby_jard/path_classifier.rb +133 -0
  41. data/lib/ruby_jard/path_filter.rb +125 -0
  42. data/lib/ruby_jard/reflection.rb +97 -0
  43. data/lib/ruby_jard/repl_processor.rb +71 -38
  44. data/lib/ruby_jard/row_renderer.rb +5 -3
  45. data/lib/ruby_jard/screen.rb +2 -2
  46. data/lib/ruby_jard/screen_manager.rb +13 -36
  47. data/lib/ruby_jard/screen_renderer.rb +1 -1
  48. data/lib/ruby_jard/screens/backtrace_screen.rb +55 -39
  49. data/lib/ruby_jard/screens/menu_screen.rb +30 -30
  50. data/lib/ruby_jard/screens/source_screen.rb +46 -62
  51. data/lib/ruby_jard/screens/threads_screen.rb +59 -72
  52. data/lib/ruby_jard/screens/variables_screen.rb +168 -124
  53. data/lib/ruby_jard/session.rb +120 -16
  54. data/lib/ruby_jard/thread_info.rb +69 -0
  55. data/lib/ruby_jard/version.rb +1 -1
  56. data/ruby_jard.gemspec +3 -1
  57. metadata +20 -39
  58. data/.travis.yml +0 -6
  59. data/CNAME +0 -1
  60. data/_config.yml +0 -1
  61. data/docs/_config.yml +0 -8
  62. data/docs/color_schemes/256-light.png +0 -0
  63. data/docs/color_schemes/256.png +0 -0
  64. data/docs/color_schemes/deep-space.png +0 -0
  65. data/docs/color_schemes/gruvbox.png +0 -0
  66. data/docs/color_schemes/one-half-dark.png +0 -0
  67. data/docs/color_schemes/one-half-light.png +0 -0
  68. data/docs/demo.png +0 -0
  69. data/docs/guide-ui.png +0 -0
  70. data/docs/index.md +0 -238
  71. data/docs/logo.jpg +0 -0
  72. data/docs/screen-backtrace.png +0 -0
  73. data/docs/screen-repl.png +0 -0
  74. data/docs/screen-source.png +0 -0
  75. data/docs/screen-threads.png +0 -0
  76. data/docs/screen-variables.png +0 -0
  77. data/images/bg_hr.png +0 -0
  78. data/images/blacktocat.png +0 -0
  79. data/images/body-bg.jpg +0 -0
  80. data/images/download-button.png +0 -0
  81. data/images/github-button.png +0 -0
  82. data/images/header-bg.jpg +0 -0
  83. data/images/highlight-bg.jpg +0 -0
  84. data/images/icon_download.png +0 -0
  85. data/images/sidebar-bg.jpg +0 -0
  86. data/images/sprite_download.png +0 -0
  87. data/javascripts/main.js +0 -1
  88. data/stylesheets/github-light.css +0 -130
  89. data/stylesheets/normalize.css +0 -424
  90. data/stylesheets/print.css +0 -228
  91. data/stylesheets/stylesheet.css +0 -245
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyJard
4
+ module Decorators
5
+ ##
6
+ # A light decorator for a string. String should be escaped, and cut off.
7
+ class StringDecorator
8
+ def initialize(generic_decorator)
9
+ @generic_decorator = generic_decorator
10
+ end
11
+
12
+ def match?(variable)
13
+ RubyJard::Reflection.call_is_a?(variable, String)
14
+ end
15
+
16
+ # rubocop:disable Lint/UnusedMethodArgument
17
+ def decorate_multiline(variable, first_line_limit:, line_limit:, lines:, depth: 0)
18
+ [
19
+ decorate_singleline(variable, line_limit: first_line_limit)
20
+ ]
21
+ end
22
+
23
+ def decorate_singleline(variable, line_limit:, depth: 0)
24
+ inspection = variable.inspect[1..-1].chomp!('"')
25
+ str =
26
+ if inspection.length < line_limit - 2
27
+ inspection
28
+ else
29
+ inspection[0..line_limit - 4] + '…'
30
+ end
31
+ [
32
+
33
+ RubyJard::Span.new(content: '"', styles: :string),
34
+ RubyJard::Span.new(content: str, styles: :string),
35
+ RubyJard::Span.new(content: '"', styles: :string)
36
+ ]
37
+ end
38
+ # rubocop:enable Lint/UnusedMethodArgument
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,79 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyJard
4
+ module Decorators
5
+ ##
6
+ # Decorator for Struct.
7
+ # TODO: This one should handle Open Struct too
8
+ class StructDecorator
9
+ def initialize(generic_decorator)
10
+ @generic_decorator = generic_decorator
11
+ @attributes_decorator = RubyJard::Decorators::AttributesDecorator.new(generic_decorator)
12
+ end
13
+
14
+ def match?(variable)
15
+ RubyJard::Reflection.call_is_a?(variable, Struct)
16
+ end
17
+
18
+ def decorate_singleline(variable, line_limit:, depth: 0)
19
+ spans = [RubyJard::Span.new(content: '#<struct', margin_right: 1, styles: :text_dim)]
20
+ unless variable.class.name.nil?
21
+ spans << RubyJard::Span.new(content: variable.class.name.to_s, margin_right: 1, styles: :text_primary)
22
+ end
23
+ spans += @attributes_decorator.inline_pairs(
24
+ variable.members.each_with_index,
25
+ total: variable.length, line_limit: line_limit - spans.map(&:content_length).sum - 1,
26
+ process_key: false, depth: depth + 1,
27
+ value_proc: ->(key) { variable[key] }
28
+ )
29
+ spans << RubyJard::Span.new(content: '>', styles: :text_dim)
30
+ end
31
+
32
+ def decorate_multiline(variable, first_line_limit:, lines:, line_limit:, depth: 0)
33
+ if variable.size > lines * 1.5
34
+ return do_decorate_multiline(variable, lines: lines, line_limit: line_limit, depth: depth)
35
+ end
36
+
37
+ singleline = decorate_singleline(variable, line_limit: first_line_limit)
38
+
39
+ if singleline.map(&:content_length).sum < line_limit || variable.length <= 1
40
+ [singleline]
41
+ else
42
+ do_decorate_multiline(variable, lines: lines, line_limit: line_limit, depth: depth)
43
+ end
44
+ end
45
+
46
+ private
47
+
48
+ def do_decorate_multiline(variable, lines:, line_limit:, depth: 0)
49
+ spans = []
50
+ start = [RubyJard::Span.new(content: '#<struct', styles: :text_dim)]
51
+ unless variable.class.name.nil?
52
+ start << RubyJard::Span.new(content: variable.class.name.to_s, margin_left: 1, styles: :text_primary)
53
+ end
54
+ start << RubyJard::Span.new(content: '>', styles: :text_dim)
55
+ spans << start
56
+
57
+ item_count = 0
58
+ variable.members.each_with_index do |member, index|
59
+ spans << @attributes_decorator.pair(
60
+ member, variable[member], line_limit: line_limit, process_key: false, depth: depth + 1
61
+ )
62
+ item_count += 1
63
+ break if index >= lines - 2
64
+ end
65
+ spans << last_line(variable.length, item_count) if variable.length > item_count
66
+ spans
67
+ end
68
+
69
+ def last_line(total, item_count)
70
+ [
71
+ RubyJard::Span.new(
72
+ content: "▸ #{total - item_count} more...",
73
+ margin_left: 2, styles: :text_dim
74
+ )
75
+ ]
76
+ end
77
+ end
78
+ end
79
+ end
@@ -6,42 +6,55 @@ module RubyJard
6
6
  # access to Byebug's internal data structure, provides some more helpers
7
7
  # and make Jard easier to test.
8
8
  class Frame
9
- attr_reader :pos
9
+ attr_reader :real_pos
10
+ attr_writer :visible
11
+ attr_accessor :virtual_pos
10
12
 
11
- def initialize(context, pos)
13
+ def initialize(context, real_pos, virtual_pos: nil)
12
14
  @context = context
13
- @pos = pos
15
+ @real_pos = real_pos
16
+ @virtual_pos = virtual_pos
17
+
18
+ @visible = true
19
+ end
20
+
21
+ def visible?
22
+ @visible == true
23
+ end
24
+
25
+ def hidden?
26
+ @visible == false
14
27
  end
15
28
 
16
29
  def frame_file
17
- @context.frame_file(@pos)
30
+ @context.frame_file(@real_pos)
18
31
  end
19
32
 
20
33
  def frame_line
21
- @context.frame_line(@pos)
34
+ @context.frame_line(@real_pos)
22
35
  end
23
36
 
24
37
  def frame_location
25
- frame_backtrace = @context.backtrace[@pos]
38
+ frame_backtrace = @context.backtrace[@real_pos]
26
39
  return nil if frame_backtrace.nil?
27
40
 
28
41
  frame_backtrace.first
29
42
  end
30
43
 
31
44
  def frame_self
32
- @context.frame_self(@pos)
45
+ @context.frame_self(@real_pos)
33
46
  end
34
47
 
35
48
  def frame_class
36
- @context.frame_class(@pos)
49
+ @context.frame_class(@real_pos)
37
50
  end
38
51
 
39
52
  def frame_binding
40
- @context.frame_binding(@pos)
53
+ @context.frame_binding(@real_pos)
41
54
  end
42
55
 
43
56
  def frame_method
44
- @context.frame_method(@pos)
57
+ @context.frame_method(@real_pos)
45
58
  end
46
59
 
47
60
  def c_frame?
@@ -35,6 +35,7 @@ module RubyJard
35
35
  SHIFT_F11 = "\e[23;2~"
36
36
  SHIFT_F12 = "\e[24;2~"
37
37
  DEFAULT_KEY_BINDINGS = {
38
+ F2 => (ACTION_FILTER = :switch_filter),
38
39
  F5 => (ACTION_LIST = :list),
39
40
  F6 => (ACTION_UP = :up),
40
41
  SHIFT_F6 => (ACTION_DOWN = :down),
@@ -20,6 +20,10 @@ module RubyJard
20
20
  width_ratio: 40
21
21
  )
22
22
  ]
23
+ ),
24
+ RubyJard::Templates::ScreenTemplate.new(
25
+ height: 2,
26
+ screen: :menu
23
27
  )
24
28
  ]
25
29
  )
@@ -17,6 +17,10 @@ module RubyJard
17
17
  height_ratio: 100
18
18
  )
19
19
  ]
20
+ ),
21
+ RubyJard::Templates::ScreenTemplate.new(
22
+ height: 2,
23
+ screen: :menu
20
24
  )
21
25
  ]
22
26
  )
@@ -29,17 +29,25 @@ module RubyJard
29
29
  !!@enabled
30
30
  end
31
31
 
32
+ ##
33
+ # Pager tracker in Pry does not expose enough
34
+ class JardPageTracker < Pry::Pager::PageTracker
35
+ attr_reader :row, :col
36
+ end
37
+
32
38
  ##
33
39
  # Pager using GNU Less
34
40
  class LessPager < Pry::Pager::NullPager
35
- def initialize(pry_instance, force_open: false, pager_start_at_the_end: false)
41
+ def initialize(pry_instance, force_open: false, pager_start_at_the_end: false, prompt: nil)
36
42
  super(pry_instance.output)
37
43
  @pry_instance = pry_instance
38
44
  @buffer = ''
39
45
 
40
46
  @pager_start_at_the_end = pager_start_at_the_end
47
+ @prompt = prompt
41
48
 
42
- @tracker = Pry::Pager::PageTracker.new(height, width)
49
+ @window_width, @window_height = RubyJard::Console.screen_size(@pry_instance.output)
50
+ @tracker = JardPageTracker.new(@window_height, @window_width)
43
51
  @pager = force_open ? open_pager : nil
44
52
  end
45
53
 
@@ -63,9 +71,11 @@ module RubyJard
63
71
  @pager.close
64
72
  @pry_instance.exec_hook :after_pager, self
65
73
 
66
- prompt = @pry_instance.prompt.wait_proc.call
67
- # TODO: should show this tip even pager not invoked, when the size exceed a certain height
68
- @out.puts "#{prompt}Tips: You can use `list` command to show back debugger screens"
74
+ list_prompt
75
+ elsif @tracker.row > @window_height / 2
76
+ @out.write @buffer
77
+
78
+ list_prompt
69
79
  else
70
80
  @out.write @buffer
71
81
  end
@@ -78,6 +88,7 @@ module RubyJard
78
88
  def open_pager
79
89
  @pry_instance.exec_hook :before_pager, self
80
90
  less_command = ['less', '-R', '-X']
91
+ less_command << "--prompt \"#{@prompt}\"" if @prompt
81
92
  less_command << '+G' if @pager_start_at_the_end
82
93
 
83
94
  IO.popen(
@@ -91,6 +102,11 @@ module RubyJard
91
102
 
92
103
  @pager.write str.encode('UTF-8', undef: :replace)
93
104
  end
105
+
106
+ def list_prompt
107
+ prompt = @pry_instance.prompt.wait_proc.call
108
+ @out.puts "#{prompt}Tips: You can use `list` command to show back debugger screens"
109
+ end
94
110
  end
95
111
  end
96
112
  end
@@ -0,0 +1,133 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
4
+ require 'rbconfig'
5
+
6
+ module RubyJard
7
+ ##
8
+ # Classify a particular path by its orign such as stdlib, gem, evaluation, etc.
9
+ # Usage
10
+ # type, *info = PathClassifier.new.class('lib/abc')
11
+ class PathClassifier
12
+ GEM_PATTERN = /(.*)-(\d+\.\d+[.\d]*[.\d]*[-.\w]*)/i.freeze
13
+ STDLIB_PATTERN = /(.*)\.rb$/.freeze
14
+ INTERNAL_PATTERN = /<internal:[^>]+>/.freeze
15
+ EVALUATION_SIGNATURE = '(eval)'
16
+ RUBY_SCRIPT_SIGNATURE = '-e'
17
+
18
+ TYPES = [
19
+ TYPE_SOURCE_TREE = :source_tree,
20
+ TYPE_GEM = :gem,
21
+ TYPE_STDLIB = :stdlib,
22
+ TYPE_INTERNAL = :internal,
23
+ TYPE_EVALUATION = :evaluation,
24
+ TYPE_RUBY_SCRIPT = :ruby_script,
25
+ TYPE_UNKNOWN = :unknown
26
+ ].freeze
27
+
28
+ def initialize
29
+ @gem_paths = fetch_gem_paths
30
+ end
31
+
32
+ def classify(path)
33
+ return TYPE_UNKNOWN if path.nil?
34
+
35
+ return TYPE_INTERNAL if try_classify_internal(path)
36
+
37
+ return TYPE_EVALUATION if try_classify_evaluation(path)
38
+
39
+ return TYPE_RUBY_SCRIPT if try_classify_ruby_script(path)
40
+
41
+ return TYPE_SOURCE_TREE if try_classify_source_tree(path)
42
+
43
+ matched, *info = try_classify_gem(path)
44
+ return TYPE_GEM, *info if matched
45
+
46
+ matched, *info = try_classify_stdlib(path)
47
+ return TYPE_STDLIB, *info if matched
48
+
49
+ TYPE_UNKNOWN
50
+ end
51
+
52
+ private
53
+
54
+ def try_classify_gem(path)
55
+ @gem_paths.each do |gem_path|
56
+ next unless path.start_with?(gem_path)
57
+
58
+ splitted_path =
59
+ path[gem_path.length..-1]
60
+ .split('/')
61
+ .reject(&:empty?)
62
+ gem_name = splitted_path.shift
63
+ gem_version = nil
64
+
65
+ match = GEM_PATTERN.match(gem_name)
66
+ if match
67
+ gem_name = match[1]
68
+ gem_version = match[2]
69
+ end
70
+
71
+ return true, gem_name, gem_version, splitted_path.join('/')
72
+ end
73
+
74
+ false
75
+ end
76
+
77
+ def try_classify_internal(path)
78
+ # https://github.com/ruby/ruby/blob/master/template/prelude.c.tmpl#L18
79
+ path =~ INTERNAL_PATTERN
80
+ end
81
+
82
+ def try_classify_stdlib(path)
83
+ lib_dir = RbConfig::CONFIG['rubylibdir'].to_s.strip
84
+
85
+ return false if lib_dir.empty?
86
+ return false unless path.start_with?(lib_dir)
87
+
88
+ splitted_path =
89
+ path[lib_dir.length..-1]
90
+ .split('/')
91
+ .reject(&:empty?)
92
+ lib_name = splitted_path.first
93
+ match = STDLIB_PATTERN.match(lib_name)
94
+ lib_name = match[1] if match
95
+
96
+ [true, lib_name, splitted_path.join('/')]
97
+ rescue NameError
98
+ # RbConfig is not available
99
+ false
100
+ end
101
+
102
+ def try_classify_evaluation(path)
103
+ path == EVALUATION_SIGNATURE
104
+ end
105
+
106
+ def try_classify_ruby_script(path)
107
+ path == RUBY_SCRIPT_SIGNATURE
108
+ end
109
+
110
+ def try_classify_source_tree(path)
111
+ path.start_with?(Dir.pwd)
112
+ end
113
+
114
+ def fetch_gem_paths
115
+ paths = []
116
+
117
+ if defined?(Gem)
118
+ Gem.path.each do |gem_path|
119
+ paths << File.join(gem_path, 'gems')
120
+ paths << gem_path
121
+ end
122
+ end
123
+
124
+ if defined?(Bundler)
125
+ bundle_path = Bundler.bundle_path.to_s
126
+ paths << File.join(bundle_path, 'gems')
127
+ paths << bundle_path
128
+ end
129
+
130
+ paths
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,125 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyJard
4
+ ##
5
+ # Check whether a particular path should be passed when debugging.
6
+ # Filtering is based on path classification (from PathClassifier),
7
+ # program's current filter mode, and filter included, excluded.
8
+ class PathFilter
9
+ FILTERS = [
10
+ FILTER_SOURCE_TREE = :source_tree,
11
+ FILTER_APPLICATION = :application,
12
+ FILTER_GEMS = :gems,
13
+ FILTER_EVERYTHING = :everything
14
+ ].freeze
15
+ def initialize(config: nil, path_classifier: nil)
16
+ @config = config || RubyJard.config
17
+ @path_classifier = path_classifier || RubyJard::PathClassifier.new
18
+ end
19
+
20
+ def match?(path)
21
+ case @config.filter
22
+ when FILTER_EVERYTHING
23
+ match_everything?(path)
24
+ when FILTER_GEMS
25
+ match_gems?(path)
26
+ when FILTER_APPLICATION
27
+ match_application?(path)
28
+ when FILTER_SOURCE_TREE
29
+ match_source_tree?(path)
30
+ end
31
+ end
32
+
33
+ private
34
+
35
+ def match_everything?(path)
36
+ return true if @config.filter_excluded.empty?
37
+
38
+ type, *info = @path_classifier.classify(path)
39
+
40
+ case type
41
+ when RubyJard::PathClassifier::TYPE_SOURCE_TREE, RubyJard::PathClassifier::TYPE_UNKNOWN
42
+ !match_excluded?(path)
43
+ when RubyJard::PathClassifier::TYPE_GEM
44
+ !match_excluded?(info[0], expand_path: false) && !match_excluded?(path)
45
+ when RubyJard::PathClassifier::TYPE_STDLIB
46
+ !match_excluded?(info[0], expand_path: false) && !match_excluded?(path)
47
+ else
48
+ true
49
+ end
50
+ end
51
+
52
+ def match_gems?(path)
53
+ type, *info = @path_classifier.classify(path)
54
+
55
+ case type
56
+ when RubyJard::PathClassifier::TYPE_SOURCE_TREE, RubyJard::PathClassifier::TYPE_UNKNOWN
57
+ !match_excluded?(path)
58
+ when RubyJard::PathClassifier::TYPE_GEM
59
+ !match_excluded?(info[0], expand_path: false) && !match_excluded?(path)
60
+ when RubyJard::PathClassifier::TYPE_STDLIB
61
+ match_included?(info[0], expand_path: false) || match_included?(path)
62
+ when RubyJard::PathClassifier::TYPE_RUBY_SCRIPT, RubyJard::PathClassifier::TYPE_EVALUATION
63
+ true
64
+ when RubyJard::PathClassifier::TYPE_INTERNAL
65
+ false
66
+ end
67
+ end
68
+
69
+ def match_application?(path)
70
+ type, *info = @path_classifier.classify(path)
71
+
72
+ case type
73
+ when RubyJard::PathClassifier::TYPE_SOURCE_TREE, RubyJard::PathClassifier::TYPE_UNKNOWN
74
+ !match_excluded?(path)
75
+ when RubyJard::PathClassifier::TYPE_GEM, RubyJard::PathClassifier::TYPE_STDLIB
76
+ match_included?(info[0], expand_path: false) || match_included?(path)
77
+ when RubyJard::PathClassifier::TYPE_RUBY_SCRIPT
78
+ true
79
+ when RubyJard::PathClassifier::TYPE_EVALUATION
80
+ false
81
+ when RubyJard::PathClassifier::TYPE_INTERNAL
82
+ false
83
+ end
84
+ end
85
+
86
+ def match_source_tree?(path)
87
+ type, *info = @path_classifier.classify(path)
88
+
89
+ case type
90
+ when RubyJard::PathClassifier::TYPE_SOURCE_TREE
91
+ !match_excluded?(path)
92
+ when RubyJard::PathClassifier::TYPE_UNKNOWN
93
+ match_included?(path)
94
+ when RubyJard::PathClassifier::TYPE_GEM, RubyJard::PathClassifier::TYPE_STDLIB
95
+ match_included?(info[0], expand_path: false) || match_included?(path)
96
+ when RubyJard::PathClassifier::TYPE_RUBY_SCRIPT
97
+ true
98
+ when RubyJard::PathClassifier::TYPE_EVALUATION
99
+ false
100
+ when RubyJard::PathClassifier::TYPE_INTERNAL
101
+ false
102
+ end
103
+ end
104
+
105
+ def match_excluded?(path, expand_path: true)
106
+ @config.filter_excluded.any? do |excluded|
107
+ if expand_path
108
+ File.fnmatch(File.expand_path(excluded), path)
109
+ else
110
+ File.fnmatch(excluded, path)
111
+ end
112
+ end
113
+ end
114
+
115
+ def match_included?(path, expand_path: true)
116
+ @config.filter_included.any? do |included|
117
+ if expand_path
118
+ File.fnmatch(File.expand_path(included), path)
119
+ else
120
+ File.fnmatch(included, path)
121
+ end
122
+ end
123
+ end
124
+ end
125
+ end