Module: Jekyll::Filters::MaxZoomLevel
- Defined in:
- lib/jekyll/filters/max_zoom_level.rb
Overview
Maximum zoom level
Class Method Summary collapse
Instance Method Summary collapse
- #jekyll_site ⇒ Object
-
#max_zoom_level(input) ⇒ Integer
Finds the maximum zoom level for an image.
Class Method Details
.jekyll_site=(site) ⇒ Object
7 8 9 |
# File 'lib/jekyll/filters/max_zoom_level.rb', line 7 def self.jekyll_site=(site) @@jekyll_site = site end |
Instance Method Details
#jekyll_site ⇒ Object
11 12 13 |
# File 'lib/jekyll/filters/max_zoom_level.rb', line 11 def jekyll_site @@jekyll_site end |
#max_zoom_level(input) ⇒ Integer
Finds the maximum zoom level for an image
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/jekyll/filters/max_zoom_level.rb', line 19 def max_zoom_level(input) return input unless input path = ::File.dirname(jekyll_site.in_source_dir(input)) unless ::File.exist? path Jekyll.logger.warn 'Max zoom level:', "File doesn't exist #{input}" return input end max_zoom_level = 0 loop do unless ::File.directory?(::File.join(path, max_zoom_level.to_s)) max_zoom_level -= 1 break end break if max_zoom_level > 18 max_zoom_level += 1 end max_zoom_level end |