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
- #dest_dir ⇒ Object
- #fallback_format ⇒ Object
- #fallback_width ⇒ Object
- #formats ⇒ 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) ⇒ 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
64 65 66 |
# File 'lib/jekyll_picture_tag/router.rb', line 64 def cdn? config.cdn? end |
#config ⇒ Object
Instructions forwarding
26 27 28 |
# File 'lib/jekyll_picture_tag/router.rb', line 26 def config @instructions.config end |
#continue_on_missing? ⇒ Boolean
60 61 62 |
# File 'lib/jekyll_picture_tag/router.rb', line 60 def continue_on_missing? config.continue_on_missing? end |
#dest_dir ⇒ Object
56 57 58 |
# File 'lib/jekyll_picture_tag/router.rb', line 56 def dest_dir config.dest_dir end |
#fallback_format ⇒ Object
82 83 84 |
# File 'lib/jekyll_picture_tag/router.rb', line 82 def fallback_format preset.fallback_format end |
#fallback_width ⇒ Object
86 87 88 |
# File 'lib/jekyll_picture_tag/router.rb', line 86 def fallback_width preset.fallback_width end |
#formats ⇒ Object
78 79 80 |
# File 'lib/jekyll_picture_tag/router.rb', line 78 def formats preset.formats end |
#html_attributes ⇒ Object
38 39 40 |
# File 'lib/jekyll_picture_tag/router.rb', line 38 def html_attributes @instructions.html_attributes end |
#media_presets ⇒ Object
34 35 36 |
# File 'lib/jekyll_picture_tag/router.rb', line 34 def media_presets @instructions.media_presets end |
#nomarkdown? ⇒ Boolean
90 91 92 |
# File 'lib/jekyll_picture_tag/router.rb', line 90 def nomarkdown? preset.nomarkdown? end |
#output_class ⇒ Object
42 43 44 |
# File 'lib/jekyll_picture_tag/router.rb', line 42 def output_class @instructions.output_class end |
#page ⇒ Object
Page which tag is called from
20 21 22 |
# File 'lib/jekyll_picture_tag/router.rb', line 20 def page @context.registers[:page] end |
#pconfig ⇒ Object
68 69 70 |
# File 'lib/jekyll_picture_tag/router.rb', line 68 def pconfig config.pconfig end |
#preset ⇒ Object
30 31 32 |
# File 'lib/jekyll_picture_tag/router.rb', line 30 def preset @instructions.preset end |
#quality(format) ⇒ Object
94 95 96 |
# File 'lib/jekyll_picture_tag/router.rb', line 94 def quality(format) preset.quality(format) end |
#site ⇒ Object
Global site data
15 16 17 |
# File 'lib/jekyll_picture_tag/router.rb', line 15 def site @context.registers[:site] end |
#source_dir ⇒ Object
Config Forwarding
52 53 54 |
# File 'lib/jekyll_picture_tag/router.rb', line 52 def source_dir config.source_dir end |
#source_images ⇒ Object
46 47 48 |
# File 'lib/jekyll_picture_tag/router.rb', line 46 def source_images @instructions.source_images end |
#widths(media) ⇒ Object
Preset forwarding
74 75 76 |
# File 'lib/jekyll_picture_tag/router.rb', line 74 def widths(media) preset.widths(media) end |