Sha256: 73c45f0b2faf8fa5c9126d282c1024cd2fc8a5c97d94a6748ae8fcb9cf205c6e

Contents?: true

Size: 525 Bytes

Versions: 1

Compression:

Stored size: 525 Bytes

Contents

module It
  # A class for links
  class Link < Tag
    include ActionView::Helpers::UrlHelper

    # See It.link for details. You can do everything there and save 6 characters.
    def initialize(href, options = {})
      fail TypeError, 'Invalid href given' unless [Hash, String].include?(href.class)

      super(:a, options)
      @href = href
    end

    # Will be called from inside the helper to return the tag with the given content.
    def process(content)
      link_to(content, @href, @options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
it-0.8.0 lib/it/link.rb