Class: Jekyll::SrcsetTag::Image::Source
- Inherits:
-
Object
- Object
- Jekyll::SrcsetTag::Image::Source
- Defined in:
- lib/jekyll/srcset_tag/image/source.rb
Instance Attribute Summary collapse
-
#fallback ⇒ Object
readonly
Returns the value of attribute fallback.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#media ⇒ Object
readonly
Returns the value of attribute media.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(width: nil, height: nil, media: nil, size: nil, fallback: nil) ⇒ Source
constructor
A new instance of Source.
- #size_string ⇒ Object
Constructor Details
#initialize(width: nil, height: nil, media: nil, size: nil, fallback: nil) ⇒ Source
Returns a new instance of Source.
7 8 9 10 11 12 13 |
# File 'lib/jekyll/srcset_tag/image/source.rb', line 7 def initialize(width: nil, height: nil, media: nil, size: nil, fallback: nil) @media = media @size = size @width = width @height = height @fallback = fallback end |
Instance Attribute Details
#fallback ⇒ Object (readonly)
Returns the value of attribute fallback.
5 6 7 |
# File 'lib/jekyll/srcset_tag/image/source.rb', line 5 def fallback @fallback end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
5 6 7 |
# File 'lib/jekyll/srcset_tag/image/source.rb', line 5 def height @height end |
#media ⇒ Object (readonly)
Returns the value of attribute media.
5 6 7 |
# File 'lib/jekyll/srcset_tag/image/source.rb', line 5 def media @media end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
5 6 7 |
# File 'lib/jekyll/srcset_tag/image/source.rb', line 5 def size @size end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
5 6 7 |
# File 'lib/jekyll/srcset_tag/image/source.rb', line 5 def width @width end |
Instance Method Details
#size_string ⇒ Object
15 16 17 |
# File 'lib/jekyll/srcset_tag/image/source.rb', line 15 def size_string (media ? media + ' ' : '') + (size || '100vw') end |