Sha256: b0e20f1b6450389c81039d617aa90e33bbd9be2cd1ddc90970ce6fbbd5573c5c

Contents?: true

Size: 349 Bytes

Versions: 8

Compression:

Stored size: 349 Bytes

Contents

# frozen_string_literal: true

module HS
  class Image < HS::Element
    attr_writer :src

    def tag_name
      'img'
    end

    def params
      super.merge(src: src)
    end

    def src
      return unless @src
      return @src if @src =~ %r{^http(s)?://}
      return @src if @src.start_with?('/')
      "/images/#{@src}"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hs-cli-0.3.3 lib/hs/elements/image.rb
hs-cli-0.3.2 lib/hs/elements/image.rb
hs-cli-0.3.1 lib/hs/elements/image.rb
hs-cli-0.3.0 lib/hs/elements/image.rb
hs-cli-0.2.2 lib/hs/elements/image.rb
hs-cli-0.2.1 lib/hs/elements/image.rb
hs-cli-0.2.0 lib/hs/elements/image.rb
hs-cli-0.1.2 lib/hs/elements/image.rb