Class: Jekyll::SrcsetTag::Image::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/srcset_tag/image/source.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#fallbackObject (readonly)

Returns the value of attribute fallback.



5
6
7
# File 'lib/jekyll/srcset_tag/image/source.rb', line 5

def fallback
  @fallback
end

#heightObject (readonly)

Returns the value of attribute height.



5
6
7
# File 'lib/jekyll/srcset_tag/image/source.rb', line 5

def height
  @height
end

#mediaObject (readonly)

Returns the value of attribute media.



5
6
7
# File 'lib/jekyll/srcset_tag/image/source.rb', line 5

def media
  @media
end

#sizeObject (readonly)

Returns the value of attribute size.



5
6
7
# File 'lib/jekyll/srcset_tag/image/source.rb', line 5

def size
  @size
end

#widthObject (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_stringObject



15
16
17
# File 'lib/jekyll/srcset_tag/image/source.rb', line 15

def size_string
  (media ? media + ' ' : '') + (size || '100vw')
end