Class: PictureTag::Instructions::Configuration
- Inherits:
-
Object
- Object
- PictureTag::Instructions::Configuration
- Defined in:
- lib/jekyll-4-picture-tag/instructions/configuration.rb
Overview
Global config (big picture). loads jekyll data/config files, and the j-p-t defaults from included yml files.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#build_source_url(filename) ⇒ Object
For linking source images ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | domain | baseurl | j-p-t source dir | filename.
-
#build_url(filename) ⇒ Object
Generated images, not source images.
-
#dest_dir ⇒ Object
site.dest is the master jekyll destination directory source_dest is the jekyll-4-picture-tag destination directory.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#jekyll_env ⇒ Object
Digs into jekyll context, returns current environment.
- #nomarkdown? ⇒ Boolean
-
#source_dir ⇒ Object
Site.source is the master jekyll source directory Source dir is the jekyll-4-picture-tag source directory.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
6 7 8 |
# File 'lib/jekyll-4-picture-tag/instructions/configuration.rb', line 6 def initialize @content = build_config end |
Instance Method Details
#[](key) ⇒ Object
10 11 12 |
# File 'lib/jekyll-4-picture-tag/instructions/configuration.rb', line 10 def [](key) @content[key] end |
#build_source_url(filename) ⇒ Object
For linking source images ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | domain | baseurl | j-p-t source dir | filename
46 47 48 |
# File 'lib/jekyll-4-picture-tag/instructions/configuration.rb', line 46 def build_source_url(filename) File.join url_prefix, self['picture']['source'], filename end |
#build_url(filename) ⇒ Object
Generated images, not source images. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | domain | baseurl | j-p-t output dir | filename
38 39 40 |
# File 'lib/jekyll-4-picture-tag/instructions/configuration.rb', line 38 def build_url(filename) File.join url_prefix, self['picture']['output'], filename end |
#dest_dir ⇒ Object
site.dest is the master jekyll destination directory source_dest is the jekyll-4-picture-tag destination directory. (generated file location setting.)
30 31 32 |
# File 'lib/jekyll-4-picture-tag/instructions/configuration.rb', line 30 def dest_dir File.join PictureTag.site.dest, self['picture']['output'] end |
#jekyll_env ⇒ Object
Digs into jekyll context, returns current environment
15 16 17 18 19 |
# File 'lib/jekyll-4-picture-tag/instructions/configuration.rb', line 15 def jekyll_env # It would be really great if the jekyll devs actually documented # the context object. PictureTag.context.environments.first['jekyll']['environment'] end |
#nomarkdown? ⇒ Boolean
50 51 52 |
# File 'lib/jekyll-4-picture-tag/instructions/configuration.rb', line 50 def nomarkdown? Utils.markdown_page? && self['picture']['nomarkdown'] end |
#source_dir ⇒ Object
Site.source is the master jekyll source directory Source dir is the jekyll-4-picture-tag source directory.
23 24 25 |
# File 'lib/jekyll-4-picture-tag/instructions/configuration.rb', line 23 def source_dir File.join PictureTag.site.source, self['picture']['source'] end |