rspec-core 3.5.4 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/Changelog.md +67 -2
- data/lib/rspec/core/bisect/server.rb +6 -1
- data/lib/rspec/core/configuration.rb +98 -21
- data/lib/rspec/core/configuration_options.rb +2 -0
- data/lib/rspec/core/drb.rb +2 -0
- data/lib/rspec/core/example.rb +9 -5
- data/lib/rspec/core/example_group.rb +6 -2
- data/lib/rspec/core/formatters/base_text_formatter.rb +3 -5
- data/lib/rspec/core/formatters/console_codes.rb +7 -4
- data/lib/rspec/core/formatters/documentation_formatter.rb +2 -1
- data/lib/rspec/core/formatters/exception_presenter.rb +8 -3
- data/lib/rspec/core/formatters/html_formatter.rb +4 -2
- data/lib/rspec/core/formatters/html_snippet_extractor.rb +2 -0
- data/lib/rspec/core/formatters/json_formatter.rb +7 -2
- data/lib/rspec/core/formatters/progress_formatter.rb +1 -0
- data/lib/rspec/core/formatters/protocol.rb +26 -25
- data/lib/rspec/core/formatters/snippet_extractor.rb +1 -3
- data/lib/rspec/core/{source → formatters}/syntax_highlighter.rb +21 -1
- data/lib/rspec/core/formatters.rb +15 -5
- data/lib/rspec/core/invocations.rb +22 -4
- data/lib/rspec/core/memoized_helpers.rb +3 -0
- data/lib/rspec/core/metadata_filter.rb +29 -17
- data/lib/rspec/core/notifications.rb +18 -2
- data/lib/rspec/core/option_parser.rb +23 -3
- data/lib/rspec/core/output_wrapper.rb +29 -0
- data/lib/rspec/core/project_initializer/.rspec +0 -1
- data/lib/rspec/core/project_initializer/spec/spec_helper.rb +1 -4
- data/lib/rspec/core/reporter.rb +22 -10
- data/lib/rspec/core/runner.rb +6 -1
- data/lib/rspec/core/set.rb +5 -0
- data/lib/rspec/core/shared_example_group.rb +39 -15
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +13 -5
- data/lib/rspec/core.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +8 -11
- metadata.gz.sig +0 -0
- data/lib/rspec/core/source/location.rb +0 -13
- data/lib/rspec/core/source/node.rb +0 -93
- data/lib/rspec/core/source/token.rb +0 -87
- data/lib/rspec/core/source.rb +0 -86
|
@@ -64,11 +64,6 @@ module RSpec
|
|
|
64
64
|
# group; any example group or example with matching metadata will
|
|
65
65
|
# automatically include this shared example group.
|
|
66
66
|
# @param block The block to be eval'd
|
|
67
|
-
# @overload shared_examples(metadata, &block)
|
|
68
|
-
# @param metadata [Array<Symbol>, Hash] metadata to attach to this
|
|
69
|
-
# group; any example group or example with matching metadata will
|
|
70
|
-
# automatically include this shared example group.
|
|
71
|
-
# @param block The block to be eval'd
|
|
72
67
|
#
|
|
73
68
|
# Stores the block for later use. The block will be evaluated
|
|
74
69
|
# in the context of an example group via `include_examples`,
|
|
@@ -153,6 +148,12 @@ module RSpec
|
|
|
153
148
|
# @private
|
|
154
149
|
class Registry
|
|
155
150
|
def add(context, name, *metadata_args, &block)
|
|
151
|
+
unless block
|
|
152
|
+
RSpec.warning "Shared example group #{name} was defined without a "\
|
|
153
|
+
"block and will have no effect. Please define a "\
|
|
154
|
+
"block or remove the definition."
|
|
155
|
+
end
|
|
156
|
+
|
|
156
157
|
if RSpec.configuration.shared_context_metadata_behavior == :trigger_inclusion
|
|
157
158
|
return legacy_add(context, name, *metadata_args, &block)
|
|
158
159
|
end
|
|
@@ -213,20 +214,43 @@ module RSpec
|
|
|
213
214
|
|
|
214
215
|
def warn_if_key_taken(context, key, new_block)
|
|
215
216
|
existing_module = shared_example_groups[context][key]
|
|
216
|
-
|
|
217
217
|
return unless existing_module
|
|
218
218
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
219
|
+
old_definition_location = formatted_location existing_module.definition
|
|
220
|
+
new_definition_location = formatted_location new_block
|
|
221
|
+
loaded_spec_files = RSpec.configuration.loaded_spec_files
|
|
222
|
+
|
|
223
|
+
if loaded_spec_files.include?(new_definition_location) && old_definition_location == new_definition_location
|
|
224
|
+
RSpec.warn_with <<-WARNING.gsub(/^ +\|/, ''), :call_site => nil
|
|
225
|
+
|WARNING: Your shared example group, '#{key}', defined at:
|
|
226
|
+
| #{old_definition_location}
|
|
227
|
+
|was automatically loaded by RSpec because the file name
|
|
228
|
+
|matches the configured autoloading pattern (#{RSpec.configuration.pattern}),
|
|
229
|
+
|and is also being required from somewhere else. To fix this
|
|
230
|
+
|warning, either rename the file to not match the pattern, or
|
|
231
|
+
|do not explicitly require the file.
|
|
232
|
+
WARNING
|
|
233
|
+
else
|
|
234
|
+
RSpec.warn_with <<-WARNING.gsub(/^ +\|/, ''), :call_site => nil
|
|
235
|
+
|WARNING: Shared example group '#{key}' has been previously defined at:
|
|
236
|
+
| #{old_definition_location}
|
|
237
|
+
|...and you are now defining it at:
|
|
238
|
+
| #{new_definition_location}
|
|
239
|
+
|The new definition will overwrite the original one.
|
|
240
|
+
WARNING
|
|
241
|
+
end
|
|
226
242
|
end
|
|
227
243
|
|
|
228
|
-
|
|
229
|
-
block
|
|
244
|
+
if RUBY_VERSION.to_f >= 1.9
|
|
245
|
+
def formatted_location(block)
|
|
246
|
+
block.source_location.join(":")
|
|
247
|
+
end
|
|
248
|
+
else # 1.8.7
|
|
249
|
+
# :nocov:
|
|
250
|
+
def formatted_location(block)
|
|
251
|
+
block.source_location.join(":").gsub(/:in.*$/, '')
|
|
252
|
+
end
|
|
253
|
+
# :nocov:
|
|
230
254
|
end
|
|
231
255
|
|
|
232
256
|
if Proc.method_defined?(:source_location)
|
data/lib/rspec/core/version.rb
CHANGED
data/lib/rspec/core/world.rb
CHANGED
|
@@ -40,7 +40,8 @@ module RSpec
|
|
|
40
40
|
def reset
|
|
41
41
|
RSpec::ExampleGroups.remove_all_constants
|
|
42
42
|
example_groups.clear
|
|
43
|
-
@
|
|
43
|
+
@sources_by_path.clear if defined?(@sources_by_path)
|
|
44
|
+
@syntax_highlighter = nil
|
|
44
45
|
end
|
|
45
46
|
|
|
46
47
|
# @private
|
|
@@ -129,11 +130,18 @@ module RSpec
|
|
|
129
130
|
end
|
|
130
131
|
|
|
131
132
|
# @private
|
|
132
|
-
def
|
|
133
|
-
@
|
|
134
|
-
RSpec::Support.
|
|
135
|
-
|
|
133
|
+
def source_from_file(path)
|
|
134
|
+
unless defined?(@sources_by_path)
|
|
135
|
+
RSpec::Support.require_rspec_support 'source'
|
|
136
|
+
@sources_by_path = {}
|
|
136
137
|
end
|
|
138
|
+
|
|
139
|
+
@sources_by_path[path] ||= Support::Source.from_file(path)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# @private
|
|
143
|
+
def syntax_highlighter
|
|
144
|
+
@syntax_highlighter ||= Formatters::SyntaxHighlighter.new(@configuration)
|
|
137
145
|
end
|
|
138
146
|
|
|
139
147
|
# @api private
|
data/lib/rspec/core.rb
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec-core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Steven Baker
|
|
@@ -46,7 +46,7 @@ cert_chain:
|
|
|
46
46
|
ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
|
|
47
47
|
F3MdtaDehhjC
|
|
48
48
|
-----END CERTIFICATE-----
|
|
49
|
-
date:
|
|
49
|
+
date: 2017-05-04 00:00:00.000000000 Z
|
|
50
50
|
dependencies:
|
|
51
51
|
- !ruby/object:Gem::Dependency
|
|
52
52
|
name: rspec-support
|
|
@@ -54,14 +54,14 @@ dependencies:
|
|
|
54
54
|
requirements:
|
|
55
55
|
- - "~>"
|
|
56
56
|
- !ruby/object:Gem::Version
|
|
57
|
-
version: 3.
|
|
57
|
+
version: 3.6.0
|
|
58
58
|
type: :runtime
|
|
59
59
|
prerelease: false
|
|
60
60
|
version_requirements: !ruby/object:Gem::Requirement
|
|
61
61
|
requirements:
|
|
62
62
|
- - "~>"
|
|
63
63
|
- !ruby/object:Gem::Version
|
|
64
|
-
version: 3.
|
|
64
|
+
version: 3.6.0
|
|
65
65
|
- !ruby/object:Gem::Dependency
|
|
66
66
|
name: cucumber
|
|
67
67
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -222,6 +222,7 @@ files:
|
|
|
222
222
|
- lib/rspec/core/formatters/progress_formatter.rb
|
|
223
223
|
- lib/rspec/core/formatters/protocol.rb
|
|
224
224
|
- lib/rspec/core/formatters/snippet_extractor.rb
|
|
225
|
+
- lib/rspec/core/formatters/syntax_highlighter.rb
|
|
225
226
|
- lib/rspec/core/hooks.rb
|
|
226
227
|
- lib/rspec/core/invocations.rb
|
|
227
228
|
- lib/rspec/core/memoized_helpers.rb
|
|
@@ -236,6 +237,7 @@ files:
|
|
|
236
237
|
- lib/rspec/core/notifications.rb
|
|
237
238
|
- lib/rspec/core/option_parser.rb
|
|
238
239
|
- lib/rspec/core/ordering.rb
|
|
240
|
+
- lib/rspec/core/output_wrapper.rb
|
|
239
241
|
- lib/rspec/core/pending.rb
|
|
240
242
|
- lib/rspec/core/profiler.rb
|
|
241
243
|
- lib/rspec/core/project_initializer.rb
|
|
@@ -250,11 +252,6 @@ files:
|
|
|
250
252
|
- lib/rspec/core/shared_context.rb
|
|
251
253
|
- lib/rspec/core/shared_example_group.rb
|
|
252
254
|
- lib/rspec/core/shell_escape.rb
|
|
253
|
-
- lib/rspec/core/source.rb
|
|
254
|
-
- lib/rspec/core/source/location.rb
|
|
255
|
-
- lib/rspec/core/source/node.rb
|
|
256
|
-
- lib/rspec/core/source/syntax_highlighter.rb
|
|
257
|
-
- lib/rspec/core/source/token.rb
|
|
258
255
|
- lib/rspec/core/test_unit_assertions_adapter.rb
|
|
259
256
|
- lib/rspec/core/version.rb
|
|
260
257
|
- lib/rspec/core/warnings.rb
|
|
@@ -280,9 +277,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
280
277
|
version: '0'
|
|
281
278
|
requirements: []
|
|
282
279
|
rubyforge_project:
|
|
283
|
-
rubygems_version: 2.
|
|
280
|
+
rubygems_version: 2.4.5.2
|
|
284
281
|
signing_key:
|
|
285
282
|
specification_version: 4
|
|
286
|
-
summary: rspec-core-3.
|
|
283
|
+
summary: rspec-core-3.6.0
|
|
287
284
|
test_files: []
|
|
288
285
|
has_rdoc:
|
metadata.gz.sig
CHANGED
|
Binary file
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
module RSpec
|
|
2
|
-
module Core
|
|
3
|
-
class Source
|
|
4
|
-
# @private
|
|
5
|
-
# Represents a source location of node or token.
|
|
6
|
-
Location = Struct.new(:line, :column) do
|
|
7
|
-
def self.location?(array)
|
|
8
|
-
array.is_a?(Array) && array.size == 2 && array.all? { |e| e.is_a?(Integer) }
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
RSpec::Support.require_rspec_core "source/location"
|
|
2
|
-
|
|
3
|
-
module RSpec
|
|
4
|
-
module Core
|
|
5
|
-
class Source
|
|
6
|
-
# @private
|
|
7
|
-
# A wrapper for Ripper AST node which is generated with `Ripper.sexp`.
|
|
8
|
-
class Node
|
|
9
|
-
include Enumerable
|
|
10
|
-
|
|
11
|
-
attr_reader :sexp, :parent
|
|
12
|
-
|
|
13
|
-
def self.sexp?(array)
|
|
14
|
-
array.is_a?(Array) && array.first.is_a?(Symbol)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def initialize(ripper_sexp, parent=nil)
|
|
18
|
-
@sexp = ripper_sexp.freeze
|
|
19
|
-
@parent = parent
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def type
|
|
23
|
-
sexp[0]
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def args
|
|
27
|
-
@args ||= raw_args.map do |raw_arg|
|
|
28
|
-
if Node.sexp?(raw_arg)
|
|
29
|
-
Node.new(raw_arg, self)
|
|
30
|
-
elsif Location.location?(raw_arg)
|
|
31
|
-
Location.new(*raw_arg)
|
|
32
|
-
elsif raw_arg.is_a?(Array)
|
|
33
|
-
GroupNode.new(raw_arg, self)
|
|
34
|
-
else
|
|
35
|
-
raw_arg
|
|
36
|
-
end
|
|
37
|
-
end.freeze
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def children
|
|
41
|
-
@children ||= args.select { |arg| arg.is_a?(Node) }.freeze
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def location
|
|
45
|
-
@location ||= args.find { |arg| arg.is_a?(Location) }
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def each(&block)
|
|
49
|
-
return to_enum(__method__) unless block_given?
|
|
50
|
-
|
|
51
|
-
yield self
|
|
52
|
-
|
|
53
|
-
children.each do |child|
|
|
54
|
-
child.each(&block)
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def each_ancestor
|
|
59
|
-
return to_enum(__method__) unless block_given?
|
|
60
|
-
|
|
61
|
-
current_node = self
|
|
62
|
-
|
|
63
|
-
while (current_node = current_node.parent)
|
|
64
|
-
yield current_node
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def inspect
|
|
69
|
-
"#<#{self.class} #{type}>"
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
private
|
|
73
|
-
|
|
74
|
-
def raw_args
|
|
75
|
-
sexp[1..-1] || []
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
# @private
|
|
80
|
-
class GroupNode < Node
|
|
81
|
-
def type
|
|
82
|
-
:group
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
private
|
|
86
|
-
|
|
87
|
-
def raw_args
|
|
88
|
-
sexp
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
end
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
RSpec::Support.require_rspec_core "source/location"
|
|
2
|
-
|
|
3
|
-
module RSpec
|
|
4
|
-
module Core
|
|
5
|
-
class Source
|
|
6
|
-
# @private
|
|
7
|
-
# A wrapper for Ripper token which is generated with `Ripper.lex`.
|
|
8
|
-
class Token
|
|
9
|
-
CLOSING_TYPES_BY_OPENING_TYPE = {
|
|
10
|
-
:on_lbracket => :on_rbracket,
|
|
11
|
-
:on_lparen => :on_rparen,
|
|
12
|
-
:on_lbrace => :on_rbrace,
|
|
13
|
-
:on_heredoc_beg => :on_heredoc_end
|
|
14
|
-
}.freeze
|
|
15
|
-
|
|
16
|
-
CLOSING_KEYWORDS_BY_OPENING_KEYWORD = {
|
|
17
|
-
'def' => 'end',
|
|
18
|
-
'do' => 'end',
|
|
19
|
-
}.freeze
|
|
20
|
-
|
|
21
|
-
attr_reader :token
|
|
22
|
-
|
|
23
|
-
def self.tokens_from_ripper_tokens(ripper_tokens)
|
|
24
|
-
ripper_tokens.map { |ripper_token| new(ripper_token) }.freeze
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def initialize(ripper_token)
|
|
28
|
-
@token = ripper_token.freeze
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def location
|
|
32
|
-
@location ||= Location.new(*token[0])
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def type
|
|
36
|
-
token[1]
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def string
|
|
40
|
-
token[2]
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def ==(other)
|
|
44
|
-
token == other.token
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
alias_method :eql?, :==
|
|
48
|
-
|
|
49
|
-
def inspect
|
|
50
|
-
"#<#{self.class} #{type} #{string.inspect}>"
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def keyword?
|
|
54
|
-
type == :on_kw
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def opening?
|
|
58
|
-
opening_delimiter? || opening_keyword?
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def closed_by?(other)
|
|
62
|
-
closed_by_delimiter?(other) || closed_by_keyword?(other)
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
private
|
|
66
|
-
|
|
67
|
-
def opening_delimiter?
|
|
68
|
-
CLOSING_TYPES_BY_OPENING_TYPE.key?(type)
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def opening_keyword?
|
|
72
|
-
return false unless keyword?
|
|
73
|
-
CLOSING_KEYWORDS_BY_OPENING_KEYWORD.key?(string)
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def closed_by_delimiter?(other)
|
|
77
|
-
other.type == CLOSING_TYPES_BY_OPENING_TYPE[type]
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def closed_by_keyword?(other)
|
|
81
|
-
return false unless other.keyword?
|
|
82
|
-
other.string == CLOSING_KEYWORDS_BY_OPENING_KEYWORD[string]
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
end
|
data/lib/rspec/core/source.rb
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
RSpec::Support.require_rspec_support "encoded_string"
|
|
2
|
-
RSpec::Support.require_rspec_core 'source/node'
|
|
3
|
-
RSpec::Support.require_rspec_core 'source/syntax_highlighter'
|
|
4
|
-
RSpec::Support.require_rspec_core 'source/token'
|
|
5
|
-
|
|
6
|
-
module RSpec
|
|
7
|
-
module Core
|
|
8
|
-
# @private
|
|
9
|
-
# Represents a Ruby source file and provides access to AST and tokens.
|
|
10
|
-
class Source
|
|
11
|
-
attr_reader :source, :path
|
|
12
|
-
|
|
13
|
-
def self.from_file(path)
|
|
14
|
-
source = File.read(path)
|
|
15
|
-
new(source, path)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
if String.method_defined?(:encoding)
|
|
19
|
-
def initialize(source_string, path=nil)
|
|
20
|
-
@source = RSpec::Support::EncodedString.new(source_string, Encoding.default_external)
|
|
21
|
-
@path = path ? File.expand_path(path) : '(string)'
|
|
22
|
-
end
|
|
23
|
-
else # for 1.8.7
|
|
24
|
-
# :nocov:
|
|
25
|
-
def initialize(source_string, path=nil)
|
|
26
|
-
@source = RSpec::Support::EncodedString.new(source_string)
|
|
27
|
-
@path = path ? File.expand_path(path) : '(string)'
|
|
28
|
-
end
|
|
29
|
-
# :nocov:
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def lines
|
|
33
|
-
@lines ||= source.split("\n")
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def ast
|
|
37
|
-
@ast ||= begin
|
|
38
|
-
require 'ripper'
|
|
39
|
-
sexp = Ripper.sexp(source)
|
|
40
|
-
raise SyntaxError unless sexp
|
|
41
|
-
Node.new(sexp)
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def tokens
|
|
46
|
-
@tokens ||= begin
|
|
47
|
-
require 'ripper'
|
|
48
|
-
tokens = Ripper.lex(source)
|
|
49
|
-
Token.tokens_from_ripper_tokens(tokens)
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def nodes_by_line_number
|
|
54
|
-
@nodes_by_line_number ||= begin
|
|
55
|
-
nodes_by_line_number = ast.select(&:location).group_by { |node| node.location.line }
|
|
56
|
-
Hash.new { |hash, key| hash[key] = [] }.merge(nodes_by_line_number)
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def tokens_by_line_number
|
|
61
|
-
@tokens_by_line_number ||= begin
|
|
62
|
-
nodes_by_line_number = tokens.group_by { |token| token.location.line }
|
|
63
|
-
Hash.new { |hash, key| hash[key] = [] }.merge(nodes_by_line_number)
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
def inspect
|
|
68
|
-
"#<#{self.class} #{path}>"
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
# @private
|
|
72
|
-
class Cache
|
|
73
|
-
attr_reader :syntax_highlighter
|
|
74
|
-
|
|
75
|
-
def initialize(configuration)
|
|
76
|
-
@sources_by_path = {}
|
|
77
|
-
@syntax_highlighter = SyntaxHighlighter.new(configuration)
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def source_from_file(path)
|
|
81
|
-
@sources_by_path[path] ||= Source.from_file(path)
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
end
|