Module: PictureTag::Router
- Included in:
- PictureTag
- Defined in:
- lib/jekyll_picture_tag/router.rb
Overview
At first I thought I’d do some sweet dynamic metaprogramming here, but it ended up complicated and clever, rather than convenient and understandable. This way is not strictly DRY, but it’s straightforward and readable. If it gets big, I’ll refactor.
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#instructions ⇒ Object
Returns the value of attribute instructions.
Instance Method Summary collapse
- #cdn? ⇒ Boolean
-
#config ⇒ Object
Instructions forwarding.
- #continue_on_missing? ⇒ Boolean
- #crop(media = nil) ⇒ Object
- #dest_dir ⇒ Object
- #disabled? ⇒ Boolean
- #fallback_format ⇒ Object
- #fallback_width ⇒ Object
- #fast_build? ⇒ Boolean
- #formats ⇒ Object
- #gravity(media = nil) ⇒ Object
- #html_attributes ⇒ Object
- #media_presets ⇒ Object
- #nomarkdown? ⇒ Boolean
- #output_class ⇒ Object
-
#page ⇒ Object
Page which tag is called from.
- #pconfig ⇒ Object
- #preset ⇒ Object
- #quality(format, width) ⇒ Object
-
#site ⇒ Object
Global site data.
-
#source_dir ⇒ Object
Config Forwarding.
- #source_images ⇒ Object
-
#widths(media) ⇒ Object
Preset forwarding.
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
11 12 13 |
# File 'lib/jekyll_picture_tag/router.rb', line 11 def context @context end |
#instructions ⇒ Object
Returns the value of attribute instructions.
11 12 13 |
# File 'lib/jekyll_picture_tag/router.rb', line 11 def instructions @instructions end |
Instance Method Details
#cdn? ⇒ Boolean
73 74 75 |
# File 'lib/jekyll_picture_tag/router.rb', line 73 def cdn? config.cdn? end |
#config ⇒ Object
Instructions forwarding
27 28 29 |
# File 'lib/jekyll_picture_tag/router.rb', line 27 def config @instructions.config end |
#continue_on_missing? ⇒ Boolean
69 70 71 |
# File 'lib/jekyll_picture_tag/router.rb', line 69 def continue_on_missing? config.continue_on_missing? end |
#crop(media = nil) ⇒ Object
51 52 53 |
# File 'lib/jekyll_picture_tag/router.rb', line 51 def crop(media = nil) @instructions.crop(media) end |
#dest_dir ⇒ Object
65 66 67 |
# File 'lib/jekyll_picture_tag/router.rb', line 65 def dest_dir config.dest_dir end |
#disabled? ⇒ Boolean
81 82 83 |
# File 'lib/jekyll_picture_tag/router.rb', line 81 def disabled? config.disabled? end |
#fallback_format ⇒ Object
99 100 101 |
# File 'lib/jekyll_picture_tag/router.rb', line 99 def fallback_format preset.fallback_format end |
#fallback_width ⇒ Object
103 104 105 |
# File 'lib/jekyll_picture_tag/router.rb', line 103 def fallback_width preset.fallback_width end |
#fast_build? ⇒ Boolean
85 86 87 |
# File 'lib/jekyll_picture_tag/router.rb', line 85 def fast_build? config.fast_build? end |
#formats ⇒ Object
95 96 97 |
# File 'lib/jekyll_picture_tag/router.rb', line 95 def formats preset.formats end |
#gravity(media = nil) ⇒ Object
55 56 57 |
# File 'lib/jekyll_picture_tag/router.rb', line 55 def gravity(media = nil) @instructions.gravity(media) end |
#html_attributes ⇒ Object
39 40 41 |
# File 'lib/jekyll_picture_tag/router.rb', line 39 def html_attributes @instructions.html_attributes end |
#media_presets ⇒ Object
35 36 37 |
# File 'lib/jekyll_picture_tag/router.rb', line 35 def media_presets @instructions.media_presets end |
#nomarkdown? ⇒ Boolean
107 108 109 |
# File 'lib/jekyll_picture_tag/router.rb', line 107 def nomarkdown? preset.nomarkdown? end |
#output_class ⇒ Object
43 44 45 |
# File 'lib/jekyll_picture_tag/router.rb', line 43 def output_class @instructions.output_class end |
#page ⇒ Object
Page which tag is called from
21 22 23 |
# File 'lib/jekyll_picture_tag/router.rb', line 21 def page @context.registers[:page] end |
#pconfig ⇒ Object
77 78 79 |
# File 'lib/jekyll_picture_tag/router.rb', line 77 def pconfig config.pconfig end |
#preset ⇒ Object
31 32 33 |
# File 'lib/jekyll_picture_tag/router.rb', line 31 def preset @instructions.preset end |
#quality(format, width) ⇒ Object
111 112 113 |
# File 'lib/jekyll_picture_tag/router.rb', line 111 def quality(format, width) preset.quality(format, width) end |
#site ⇒ Object
Global site data
16 17 18 |
# File 'lib/jekyll_picture_tag/router.rb', line 16 def site @context.registers[:site] end |
#source_dir ⇒ Object
Config Forwarding
61 62 63 |
# File 'lib/jekyll_picture_tag/router.rb', line 61 def source_dir config.source_dir end |
#source_images ⇒ Object
47 48 49 |
# File 'lib/jekyll_picture_tag/router.rb', line 47 def source_images @instructions.source_images end |
#widths(media) ⇒ Object
Preset forwarding
91 92 93 |
# File 'lib/jekyll_picture_tag/router.rb', line 91 def widths(media) preset.widths(media) end |