Class: HS::Image
Instance Attribute Summary collapse
Attributes inherited from Element
#children, #class_name, #style
Instance Method Summary collapse
Methods inherited from Element
Methods included from ElementPreview
#element_preview, #text_preview
Constructor Details
This class inherits a constructor from HS::Element
Instance Attribute Details
#src ⇒ Object
15 16 17 18 19 20 |
# File 'lib/hs/elements/image.rb', line 15 def src return unless @src return @src if @src =~ %r{^http(s)?://} return @src if @src.start_with?('/') "/images/#{@src}" end |
Instance Method Details
#params ⇒ Object
11 12 13 |
# File 'lib/hs/elements/image.rb', line 11 def params super.merge(src: src) end |
#tag_name ⇒ Object
7 8 9 |
# File 'lib/hs/elements/image.rb', line 7 def tag_name 'img' end |