Sha256: 6e5b8e0459c8953e8e1a67047a7f264da95a3ee6e0cfb698f94bc3a7738d5013

Contents?: true

Size: 553 Bytes

Versions: 4

Compression:

Stored size: 553 Bytes

Contents

require 'bh/classes/base'

module Bh
  module Classes
    class LinkTo < Base
      def initialize(app = nil, *args, &block)
        @url = extract_url_from(*args, &block)
        super
      end

      def current_page?
        case Bh.framework
        when :rails
          @app.current_page? @url
        when :padrino, :middleman
          request = Bh.framework == :middleman ? @app.req : @app.request
          request.path_info == @app.url_for(@url)
        end
      end

      def content
        super if @content
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bh-1.3.6 lib/bh/classes/link_to.rb
bh-1.3.5 lib/bh/classes/link_to.rb
bh-1.3.4 lib/bh/classes/link_to.rb
bh-1.3.3 lib/bh/classes/link_to.rb