jekyll 4.2.1 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +474 -350
  3. data/LICENSE +21 -21
  4. data/README.markdown +83 -86
  5. data/exe/jekyll +57 -57
  6. data/lib/blank_template/_config.yml +3 -3
  7. data/lib/blank_template/_layouts/default.html +12 -12
  8. data/lib/blank_template/_sass/main.scss +9 -9
  9. data/lib/blank_template/assets/css/main.scss +4 -4
  10. data/lib/blank_template/index.md +8 -8
  11. data/lib/jekyll/cache.rb +186 -190
  12. data/lib/jekyll/cleaner.rb +111 -111
  13. data/lib/jekyll/collection.rb +310 -309
  14. data/lib/jekyll/command.rb +105 -105
  15. data/lib/jekyll/commands/build.rb +82 -93
  16. data/lib/jekyll/commands/clean.rb +44 -45
  17. data/lib/jekyll/commands/doctor.rb +177 -177
  18. data/lib/jekyll/commands/help.rb +34 -34
  19. data/lib/jekyll/commands/new.rb +168 -169
  20. data/lib/jekyll/commands/new_theme.rb +39 -40
  21. data/lib/jekyll/commands/serve/live_reload_reactor.rb +119 -122
  22. data/lib/jekyll/commands/serve/livereload_assets/livereload.js +1183 -1183
  23. data/lib/jekyll/commands/serve/mime_types_charset.json +71 -0
  24. data/lib/jekyll/commands/serve/servlet.rb +206 -202
  25. data/lib/jekyll/commands/serve/websockets.rb +81 -81
  26. data/lib/jekyll/commands/serve.rb +367 -362
  27. data/lib/jekyll/configuration.rb +313 -313
  28. data/lib/jekyll/converter.rb +54 -54
  29. data/lib/jekyll/converters/identity.rb +41 -41
  30. data/lib/jekyll/converters/markdown/kramdown_parser.rb +197 -199
  31. data/lib/jekyll/converters/markdown.rb +113 -113
  32. data/lib/jekyll/converters/smartypants.rb +70 -70
  33. data/lib/jekyll/convertible.rb +257 -257
  34. data/lib/jekyll/data_entry.rb +83 -0
  35. data/lib/jekyll/data_hash.rb +61 -0
  36. data/lib/jekyll/deprecator.rb +50 -50
  37. data/lib/jekyll/document.rb +543 -544
  38. data/lib/jekyll/drops/collection_drop.rb +20 -20
  39. data/lib/jekyll/drops/document_drop.rb +71 -70
  40. data/lib/jekyll/drops/drop.rb +293 -293
  41. data/lib/jekyll/drops/excerpt_drop.rb +23 -19
  42. data/lib/jekyll/drops/jekyll_drop.rb +32 -32
  43. data/lib/jekyll/drops/site_drop.rb +71 -66
  44. data/lib/jekyll/drops/static_file_drop.rb +14 -14
  45. data/lib/jekyll/drops/theme_drop.rb +36 -0
  46. data/lib/jekyll/drops/unified_payload_drop.rb +30 -26
  47. data/lib/jekyll/drops/url_drop.rb +140 -140
  48. data/lib/jekyll/entry_filter.rb +117 -121
  49. data/lib/jekyll/errors.rb +20 -20
  50. data/lib/jekyll/excerpt.rb +200 -201
  51. data/lib/jekyll/external.rb +75 -79
  52. data/lib/jekyll/filters/date_filters.rb +110 -110
  53. data/lib/jekyll/filters/grouping_filters.rb +64 -64
  54. data/lib/jekyll/filters/url_filters.rb +98 -98
  55. data/lib/jekyll/filters.rb +532 -535
  56. data/lib/jekyll/frontmatter_defaults.rb +238 -240
  57. data/lib/jekyll/generator.rb +5 -5
  58. data/lib/jekyll/hooks.rb +107 -107
  59. data/lib/jekyll/inclusion.rb +32 -32
  60. data/lib/jekyll/layout.rb +55 -67
  61. data/lib/jekyll/liquid_extensions.rb +22 -22
  62. data/lib/jekyll/liquid_renderer/file.rb +77 -77
  63. data/lib/jekyll/liquid_renderer/table.rb +55 -55
  64. data/lib/jekyll/liquid_renderer.rb +80 -80
  65. data/lib/jekyll/log_adapter.rb +151 -151
  66. data/lib/jekyll/mime.types +939 -866
  67. data/lib/jekyll/page.rb +215 -217
  68. data/lib/jekyll/page_excerpt.rb +25 -25
  69. data/lib/jekyll/page_without_a_file.rb +14 -14
  70. data/lib/jekyll/path_manager.rb +74 -74
  71. data/lib/jekyll/plugin.rb +92 -92
  72. data/lib/jekyll/plugin_manager.rb +123 -115
  73. data/lib/jekyll/profiler.rb +55 -58
  74. data/lib/jekyll/publisher.rb +23 -23
  75. data/lib/jekyll/reader.rb +209 -192
  76. data/lib/jekyll/readers/collection_reader.rb +23 -23
  77. data/lib/jekyll/readers/data_reader.rb +116 -79
  78. data/lib/jekyll/readers/layout_reader.rb +62 -62
  79. data/lib/jekyll/readers/page_reader.rb +25 -25
  80. data/lib/jekyll/readers/post_reader.rb +85 -85
  81. data/lib/jekyll/readers/static_file_reader.rb +25 -25
  82. data/lib/jekyll/readers/theme_assets_reader.rb +52 -52
  83. data/lib/jekyll/regenerator.rb +195 -195
  84. data/lib/jekyll/related_posts.rb +52 -52
  85. data/lib/jekyll/renderer.rb +263 -265
  86. data/lib/jekyll/site.rb +582 -551
  87. data/lib/jekyll/static_file.rb +205 -208
  88. data/lib/jekyll/stevenson.rb +60 -60
  89. data/lib/jekyll/tags/highlight.rb +114 -110
  90. data/lib/jekyll/tags/include.rb +275 -275
  91. data/lib/jekyll/tags/link.rb +42 -42
  92. data/lib/jekyll/tags/post_url.rb +106 -106
  93. data/lib/jekyll/theme.rb +90 -86
  94. data/lib/jekyll/theme_builder.rb +121 -121
  95. data/lib/jekyll/url.rb +167 -167
  96. data/lib/jekyll/utils/ansi.rb +57 -57
  97. data/lib/jekyll/utils/exec.rb +26 -26
  98. data/lib/jekyll/utils/internet.rb +37 -37
  99. data/lib/jekyll/utils/platforms.rb +67 -67
  100. data/lib/jekyll/utils/thread_event.rb +31 -31
  101. data/lib/jekyll/utils/win_tz.rb +46 -75
  102. data/lib/jekyll/utils.rb +378 -367
  103. data/lib/jekyll/version.rb +5 -5
  104. data/lib/jekyll.rb +197 -195
  105. data/lib/site_template/.gitignore +5 -5
  106. data/lib/site_template/404.html +25 -25
  107. data/lib/site_template/_config.yml +55 -55
  108. data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +29 -29
  109. data/lib/site_template/about.markdown +18 -18
  110. data/lib/site_template/index.markdown +6 -6
  111. data/lib/theme_template/CODE_OF_CONDUCT.md.erb +74 -74
  112. data/lib/theme_template/Gemfile +4 -4
  113. data/lib/theme_template/LICENSE.txt.erb +21 -21
  114. data/lib/theme_template/README.md.erb +50 -52
  115. data/lib/theme_template/_layouts/default.html +1 -1
  116. data/lib/theme_template/_layouts/page.html +5 -5
  117. data/lib/theme_template/_layouts/post.html +5 -5
  118. data/lib/theme_template/example/_config.yml.erb +1 -1
  119. data/lib/theme_template/example/_post.md +12 -12
  120. data/lib/theme_template/example/index.html +14 -14
  121. data/lib/theme_template/example/style.scss +7 -7
  122. data/lib/theme_template/gitignore.erb +6 -6
  123. data/lib/theme_template/theme.gemspec.erb +16 -16
  124. data/rubocop/jekyll/assert_equal_literal_actual.rb +149 -149
  125. data/rubocop/jekyll/no_p_allowed.rb +23 -23
  126. data/rubocop/jekyll/no_puts_allowed.rb +23 -23
  127. data/rubocop/jekyll.rb +5 -5
  128. metadata +62 -14
data/lib/jekyll/hooks.rb CHANGED
@@ -1,107 +1,107 @@
1
- # frozen_string_literal: true
2
-
3
- module Jekyll
4
- module Hooks
5
- DEFAULT_PRIORITY = 20
6
-
7
- # compatibility layer for octopress-hooks users
8
- PRIORITY_MAP = {
9
- :low => 10,
10
- :normal => 20,
11
- :high => 30,
12
- }.freeze
13
-
14
- # initial empty hooks
15
- @registry = {
16
- :site => {
17
- :after_init => [],
18
- :after_reset => [],
19
- :post_read => [],
20
- :pre_render => [],
21
- :post_render => [],
22
- :post_write => [],
23
- },
24
- :pages => {
25
- :post_init => [],
26
- :pre_render => [],
27
- :post_convert => [],
28
- :post_render => [],
29
- :post_write => [],
30
- },
31
- :posts => {
32
- :post_init => [],
33
- :pre_render => [],
34
- :post_convert => [],
35
- :post_render => [],
36
- :post_write => [],
37
- },
38
- :documents => {
39
- :post_init => [],
40
- :pre_render => [],
41
- :post_convert => [],
42
- :post_render => [],
43
- :post_write => [],
44
- },
45
- :clean => {
46
- :on_obsolete => [],
47
- },
48
- }
49
-
50
- # map of all hooks and their priorities
51
- @hook_priority = {}
52
-
53
- NotAvailable = Class.new(RuntimeError)
54
- Uncallable = Class.new(RuntimeError)
55
-
56
- # register hook(s) to be called later, public API
57
- def self.register(owners, event, priority: DEFAULT_PRIORITY, &block)
58
- Array(owners).each do |owner|
59
- register_one(owner, event, priority_value(priority), &block)
60
- end
61
- end
62
-
63
- # Ensure the priority is a Fixnum
64
- def self.priority_value(priority)
65
- return priority if priority.is_a?(Integer)
66
-
67
- PRIORITY_MAP[priority] || DEFAULT_PRIORITY
68
- end
69
-
70
- # register a single hook to be called later, internal API
71
- def self.register_one(owner, event, priority, &block)
72
- @registry[owner] ||= {
73
- :post_init => [],
74
- :pre_render => [],
75
- :post_convert => [],
76
- :post_render => [],
77
- :post_write => [],
78
- }
79
-
80
- unless @registry[owner][event]
81
- raise NotAvailable, "Invalid hook. #{owner} supports only the " \
82
- "following hooks #{@registry[owner].keys.inspect}"
83
- end
84
-
85
- raise Uncallable, "Hooks must respond to :call" unless block.respond_to? :call
86
-
87
- insert_hook owner, event, priority, &block
88
- end
89
-
90
- def self.insert_hook(owner, event, priority, &block)
91
- @hook_priority[block] = [-priority, @hook_priority.size]
92
- @registry[owner][event] << block
93
- end
94
-
95
- # interface for Jekyll core components to trigger hooks
96
- def self.trigger(owner, event, *args)
97
- # proceed only if there are hooks to call
98
- hooks = @registry.dig(owner, event)
99
- return if hooks.nil? || hooks.empty?
100
-
101
- # sort and call hooks according to priority and load order
102
- hooks.sort_by { |h| @hook_priority[h] }.each do |hook|
103
- hook.call(*args)
104
- end
105
- end
106
- end
107
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module Hooks
5
+ DEFAULT_PRIORITY = 20
6
+
7
+ # compatibility layer for octopress-hooks users
8
+ PRIORITY_MAP = {
9
+ :low => 10,
10
+ :normal => 20,
11
+ :high => 30,
12
+ }.freeze
13
+
14
+ # initial empty hooks
15
+ @registry = {
16
+ :site => {
17
+ :after_init => [],
18
+ :after_reset => [],
19
+ :post_read => [],
20
+ :pre_render => [],
21
+ :post_render => [],
22
+ :post_write => [],
23
+ },
24
+ :pages => {
25
+ :post_init => [],
26
+ :pre_render => [],
27
+ :post_convert => [],
28
+ :post_render => [],
29
+ :post_write => [],
30
+ },
31
+ :posts => {
32
+ :post_init => [],
33
+ :pre_render => [],
34
+ :post_convert => [],
35
+ :post_render => [],
36
+ :post_write => [],
37
+ },
38
+ :documents => {
39
+ :post_init => [],
40
+ :pre_render => [],
41
+ :post_convert => [],
42
+ :post_render => [],
43
+ :post_write => [],
44
+ },
45
+ :clean => {
46
+ :on_obsolete => [],
47
+ },
48
+ }
49
+
50
+ # map of all hooks and their priorities
51
+ @hook_priority = {}
52
+
53
+ NotAvailable = Class.new(RuntimeError)
54
+ Uncallable = Class.new(RuntimeError)
55
+
56
+ # register hook(s) to be called later, public API
57
+ def self.register(owners, event, priority: DEFAULT_PRIORITY, &block)
58
+ Array(owners).each do |owner|
59
+ register_one(owner, event, priority_value(priority), &block)
60
+ end
61
+ end
62
+
63
+ # Ensure the priority is a Fixnum
64
+ def self.priority_value(priority)
65
+ return priority if priority.is_a?(Integer)
66
+
67
+ PRIORITY_MAP[priority] || DEFAULT_PRIORITY
68
+ end
69
+
70
+ # register a single hook to be called later, internal API
71
+ def self.register_one(owner, event, priority, &block)
72
+ @registry[owner] ||= {
73
+ :post_init => [],
74
+ :pre_render => [],
75
+ :post_convert => [],
76
+ :post_render => [],
77
+ :post_write => [],
78
+ }
79
+
80
+ unless @registry[owner][event]
81
+ raise NotAvailable, "Invalid hook. #{owner} supports only the following hooks " \
82
+ "#{@registry[owner].keys.inspect}"
83
+ end
84
+
85
+ raise Uncallable, "Hooks must respond to :call" unless block.respond_to? :call
86
+
87
+ insert_hook owner, event, priority, &block
88
+ end
89
+
90
+ def self.insert_hook(owner, event, priority, &block)
91
+ @hook_priority[block] = [-priority, @hook_priority.size]
92
+ @registry[owner][event] << block
93
+ end
94
+
95
+ # interface for Jekyll core components to trigger hooks
96
+ def self.trigger(owner, event, *args)
97
+ # proceed only if there are hooks to call
98
+ hooks = @registry.dig(owner, event)
99
+ return if hooks.nil? || hooks.empty?
100
+
101
+ # sort and call hooks according to priority and load order
102
+ hooks.sort_by { |h| @hook_priority[h] }.each do |hook|
103
+ hook.call(*args)
104
+ end
105
+ end
106
+ end
107
+ end
@@ -1,32 +1,32 @@
1
- # frozen_string_literal: true
2
-
3
- module Jekyll
4
- class Inclusion
5
- attr_reader :site, :name, :path
6
- private :site
7
-
8
- def initialize(site, base, name)
9
- @site = site
10
- @name = name
11
- @path = PathManager.join(base, name)
12
- end
13
-
14
- def render(context)
15
- @template ||= site.liquid_renderer.file(path).parse(content)
16
- @template.render!(context)
17
- rescue Liquid::Error => e
18
- e.template_name = path
19
- e.markup_context = "included " if e.markup_context.nil?
20
- raise e
21
- end
22
-
23
- def content
24
- @content ||= File.read(path, **site.file_read_opts)
25
- end
26
-
27
- def inspect
28
- "#{self.class} #{path.inspect}"
29
- end
30
- alias_method :to_s, :inspect
31
- end
32
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ class Inclusion
5
+ attr_reader :site, :name, :path
6
+ private :site
7
+
8
+ def initialize(site, base, name)
9
+ @site = site
10
+ @name = name
11
+ @path = PathManager.join(base, name)
12
+ end
13
+
14
+ def render(context)
15
+ @template ||= site.liquid_renderer.file(path).parse(content)
16
+ @template.render!(context)
17
+ rescue Liquid::Error => e
18
+ e.template_name = path
19
+ e.markup_context = "included " if e.markup_context.nil?
20
+ raise e
21
+ end
22
+
23
+ def content
24
+ @content ||= File.read(path, **site.file_read_opts)
25
+ end
26
+
27
+ def inspect
28
+ "#{self.class} #{path.inspect}"
29
+ end
30
+ alias_method :to_s, :inspect
31
+ end
32
+ end
data/lib/jekyll/layout.rb CHANGED
@@ -1,67 +1,55 @@
1
- # frozen_string_literal: true
2
-
3
- module Jekyll
4
- class Layout
5
- include Convertible
6
-
7
- # Gets the Site object.
8
- attr_reader :site
9
-
10
- # Gets the name of this layout.
11
- attr_reader :name
12
-
13
- # Gets the path to this layout.
14
- attr_reader :path
15
-
16
- # Gets the path to this layout relative to its base
17
- attr_reader :relative_path
18
-
19
- # Gets/Sets the extension of this layout.
20
- attr_accessor :ext
21
-
22
- # Gets/Sets the Hash that holds the metadata for this layout.
23
- attr_accessor :data
24
-
25
- # Gets/Sets the content of this layout.
26
- attr_accessor :content
27
-
28
- # Initialize a new Layout.
29
- #
30
- # site - The Site.
31
- # base - The String path to the source.
32
- # name - The String filename of the post file.
33
- def initialize(site, base, name)
34
- @site = site
35
- @base = base
36
- @name = name
37
-
38
- if site.theme && site.theme.layouts_path.eql?(base)
39
- @base_dir = site.theme.root
40
- @path = site.in_theme_dir(base, name)
41
- else
42
- @base_dir = site.source
43
- @path = site.in_source_dir(base, name)
44
- end
45
- @relative_path = @path.sub(@base_dir, "")
46
-
47
- self.data = {}
48
-
49
- process(name)
50
- read_yaml(base, name)
51
- end
52
-
53
- # Extract information from the layout filename.
54
- #
55
- # name - The String filename of the layout file.
56
- #
57
- # Returns nothing.
58
- def process(name)
59
- self.ext = File.extname(name)
60
- end
61
-
62
- # Returns the object as a debug String.
63
- def inspect
64
- "#<#{self.class} @path=#{@path.inspect}>"
65
- end
66
- end
67
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ class Layout
5
+ include Convertible
6
+
7
+ attr_accessor :content, # content of layout
8
+ :data, # the Hash that holds the metadata for this layout
9
+ :ext # extension of layout
10
+
11
+ attr_reader :name, # name of layout
12
+ :path, # path to layout
13
+ :site, # the Site object
14
+ :relative_path # path to layout relative to its base
15
+
16
+ # Initialize a new Layout.
17
+ #
18
+ # site - The Site.
19
+ # base - The String path to the source.
20
+ # name - The String filename of the post file.
21
+ def initialize(site, base, name)
22
+ @site = site
23
+ @base = base
24
+ @name = name
25
+
26
+ if site.theme && site.theme.layouts_path.eql?(base)
27
+ @base_dir = site.theme.root
28
+ @path = site.in_theme_dir(base, name)
29
+ else
30
+ @base_dir = site.source
31
+ @path = site.in_source_dir(base, name)
32
+ end
33
+ @relative_path = @path.sub(@base_dir, "")
34
+
35
+ self.data = {}
36
+
37
+ process(name)
38
+ read_yaml(base, name)
39
+ end
40
+
41
+ # Extract information from the layout filename.
42
+ #
43
+ # name - The String filename of the layout file.
44
+ #
45
+ # Returns nothing.
46
+ def process(name)
47
+ self.ext = File.extname(name)
48
+ end
49
+
50
+ # Returns the object as a debug String.
51
+ def inspect
52
+ "#<#{self.class} @path=#{@path.inspect}>"
53
+ end
54
+ end
55
+ end
@@ -1,22 +1,22 @@
1
- # frozen_string_literal: true
2
-
3
- module Jekyll
4
- module LiquidExtensions
5
- # Lookup a Liquid variable in the given context.
6
- #
7
- # context - the Liquid context in question.
8
- # variable - the variable name, as a string.
9
- #
10
- # Returns the value of the variable in the context
11
- # or the variable name if not found.
12
- def lookup_variable(context, variable)
13
- lookup = context
14
-
15
- variable.split(".").each do |value|
16
- lookup = lookup[value]
17
- end
18
-
19
- lookup || variable
20
- end
21
- end
22
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module LiquidExtensions
5
+ # Lookup a Liquid variable in the given context.
6
+ #
7
+ # context - the Liquid context in question.
8
+ # variable - the variable name, as a string.
9
+ #
10
+ # Returns the value of the variable in the context
11
+ # or the variable name if not found.
12
+ def lookup_variable(context, variable)
13
+ lookup = context
14
+
15
+ variable.split(".").each do |value|
16
+ lookup = lookup[value]
17
+ end
18
+
19
+ lookup || variable
20
+ end
21
+ end
22
+ end
@@ -1,77 +1,77 @@
1
- # frozen_string_literal: true
2
-
3
- module Jekyll
4
- class LiquidRenderer
5
- class File
6
- def initialize(renderer, filename)
7
- @renderer = renderer
8
- @filename = filename
9
- end
10
-
11
- def parse(content)
12
- measure_time do
13
- @renderer.cache[@filename] ||= Liquid::Template.parse(content, :line_numbers => true)
14
- end
15
- @template = @renderer.cache[@filename]
16
-
17
- self
18
- end
19
-
20
- def render(*args)
21
- reset_template_assigns
22
-
23
- measure_time do
24
- measure_bytes do
25
- measure_counts do
26
- @template.render(*args)
27
- end
28
- end
29
- end
30
- end
31
-
32
- # This method simply 'rethrows any error' before attempting to render the template.
33
- def render!(*args)
34
- reset_template_assigns
35
-
36
- measure_time do
37
- measure_bytes do
38
- measure_counts do
39
- @template.render!(*args)
40
- end
41
- end
42
- end
43
- end
44
-
45
- def warnings
46
- @template.warnings
47
- end
48
-
49
- private
50
-
51
- # clear assigns to `Liquid::Template` instance prior to rendering since
52
- # `Liquid::Template` instances are cached in Jekyll 4.
53
- def reset_template_assigns
54
- @template.instance_assigns.clear
55
- end
56
-
57
- def measure_counts
58
- @renderer.increment_count(@filename)
59
- yield
60
- end
61
-
62
- def measure_bytes
63
- yield.tap do |str|
64
- @renderer.increment_bytes(@filename, str.bytesize)
65
- end
66
- end
67
-
68
- def measure_time
69
- before = Time.now
70
- yield
71
- ensure
72
- after = Time.now
73
- @renderer.increment_time(@filename, after - before)
74
- end
75
- end
76
- end
77
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ class LiquidRenderer
5
+ class File
6
+ def initialize(renderer, filename)
7
+ @renderer = renderer
8
+ @filename = filename
9
+ end
10
+
11
+ def parse(content)
12
+ measure_time do
13
+ @renderer.cache[@filename] ||= Liquid::Template.parse(content, :line_numbers => true)
14
+ end
15
+ @template = @renderer.cache[@filename]
16
+
17
+ self
18
+ end
19
+
20
+ def render(*args)
21
+ reset_template_assigns
22
+
23
+ measure_time do
24
+ measure_bytes do
25
+ measure_counts do
26
+ @template.render(*args)
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ # This method simply 'rethrows any error' before attempting to render the template.
33
+ def render!(*args)
34
+ reset_template_assigns
35
+
36
+ measure_time do
37
+ measure_bytes do
38
+ measure_counts do
39
+ @template.render!(*args)
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ def warnings
46
+ @template.warnings
47
+ end
48
+
49
+ private
50
+
51
+ # clear assigns to `Liquid::Template` instance prior to rendering since
52
+ # `Liquid::Template` instances are cached in Jekyll 4.
53
+ def reset_template_assigns
54
+ @template.instance_assigns.clear
55
+ end
56
+
57
+ def measure_counts
58
+ @renderer.increment_count(@filename)
59
+ yield
60
+ end
61
+
62
+ def measure_bytes
63
+ yield.tap do |str|
64
+ @renderer.increment_bytes(@filename, str.bytesize)
65
+ end
66
+ end
67
+
68
+ def measure_time
69
+ before = Time.now
70
+ yield
71
+ ensure
72
+ after = Time.now
73
+ @renderer.increment_time(@filename, after - before)
74
+ end
75
+ end
76
+ end
77
+ end