Sha256: 6c0337a8c5463083e9e63764d5aab1e2f2bd32efcc85bc743a7e0dbb868d50dd

Contents?: true

Size: 467 Bytes

Versions: 1

Compression:

Stored size: 467 Bytes

Contents

# frozen_string_literal: true

module Staticky
  module Phlex
    module ViewHelpers
      def helpers
        @_view_context
      end

      def link_to(text = nil, href, **, &block) # rubocop:disable Style/OptionalArguments
        block ||= proc { text }
        href = Staticky.router.resolve(href)
        href = href.uri.to_s unless href.is_a?(String)

        a(href:, **, &block)
      end
    end
  end
end

Phlex::SGML.prepend Staticky::Phlex::ViewHelpers

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
staticky-0.2.0 lib/staticky/phlex/view_helpers.rb