Sha256: 93cebf518fc6ec463d2c4cc1b55f0a3cbd500d34b344c5deba84e4b26a2644a4

Contents?: true

Size: 606 Bytes

Versions: 1

Compression:

Stored size: 606 Bytes

Contents

require 'deas-erbtags/tag'
require 'deas-erbtags/capture_tag'

module Deas::ErbTags
  module LinkTo

    def self.included(receiver)
      receiver.class_eval{ include Tag, CaptureTag, Method }
    end

    module Method

      def link_to(*args, &block)
        opts, href, content = [
          args.last.kind_of?(::Hash) ? args.pop : {},
          args.pop,
          args.last
        ]
        opts.update(:href => href.to_s) if !href.nil?

        if block_given?
          capture_tag(:a, opts, &block)
        else
          tag(:a, content || href, opts)
        end
      end

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
deas-erbtags-0.2.0 lib/deas-erbtags/link_to.rb