Sha256: 07fd3599a1a7434a1af66d0d8a69f3bee2c8c29e47ea1f225fe270c2ae7827ef

Contents?: true

Size: 308 Bytes

Versions: 8

Compression:

Stored size: 308 Bytes

Contents

# frozen_string_literal: true

module HS
  class Link < HS::Element
    attr_accessor :to

    def tag_name
      'a'
    end

    def params
      super.merge(href: href)
    end

    def href
      return to if to =~ %r{^http(s)?://}
      return to if to.start_with?('/')
      "/#{to}"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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