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

Instance Method Summary collapse

Instance Attribute Details

#contextObject

Returns the value of attribute context.



11
12
13
# File 'lib/jekyll_picture_tag/router.rb', line 11

def context
  @context
end

#instructionsObject

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

Returns:

  • (Boolean)


64
65
66
# File 'lib/jekyll_picture_tag/router.rb', line 64

def cdn?
  config.cdn?
end

#configObject

Instructions forwarding



26
27
28
# File 'lib/jekyll_picture_tag/router.rb', line 26

def config
  @instructions.config
end

#continue_on_missing?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/jekyll_picture_tag/router.rb', line 60

def continue_on_missing?
  config.continue_on_missing?
end

#dest_dirObject



56
57
58
# File 'lib/jekyll_picture_tag/router.rb', line 56

def dest_dir
  config.dest_dir
end

#fallback_formatObject



82
83
84
# File 'lib/jekyll_picture_tag/router.rb', line 82

def fallback_format
  preset.fallback_format
end

#fallback_widthObject



86
87
88
# File 'lib/jekyll_picture_tag/router.rb', line 86

def fallback_width
  preset.fallback_width
end

#formatsObject



78
79
80
# File 'lib/jekyll_picture_tag/router.rb', line 78

def formats
  preset.formats
end

#html_attributesObject



38
39
40
# File 'lib/jekyll_picture_tag/router.rb', line 38

def html_attributes
  @instructions.html_attributes
end

#media_presetsObject



34
35
36
# File 'lib/jekyll_picture_tag/router.rb', line 34

def media_presets
  @instructions.media_presets
end

#nomarkdown?Boolean

Returns:

  • (Boolean)


90
91
92
# File 'lib/jekyll_picture_tag/router.rb', line 90

def nomarkdown?
  preset.nomarkdown?
end

#output_classObject



42
43
44
# File 'lib/jekyll_picture_tag/router.rb', line 42

def output_class
  @instructions.output_class
end

#pageObject

Page which tag is called from



20
21
22
# File 'lib/jekyll_picture_tag/router.rb', line 20

def page
  @context.registers[:page]
end

#pconfigObject



68
69
70
# File 'lib/jekyll_picture_tag/router.rb', line 68

def pconfig
  config.pconfig
end

#presetObject



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

#siteObject

Global site data



15
16
17
# File 'lib/jekyll_picture_tag/router.rb', line 15

def site
  @context.registers[:site]
end

#source_dirObject

Config Forwarding



52
53
54
# File 'lib/jekyll_picture_tag/router.rb', line 52

def source_dir
  config.source_dir
end

#source_imagesObject



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