Sha256: 641b0057682bf64ae5a1f1b3ad776bf636cf7c216288f74a2d6bdb5d60526f17

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module EacRailsBase0
  module Patches
    module EacRailsUtilsLinksHelper
      class << self
        def included(base)
          base.include(InstanceMethods)
          base.alias_method_chain :short_object_link, :base0
          base.alias_method_chain :object_path_by_class, :base0
        end
      end

      module InstanceMethods
        def short_object_link_with_base0(object, action = nil, options = {})
          value_or_sign(object, '') do |value|
            path = object_path(value, action)
            link_to '', url_for(path), options if can_by_path?(path, options[:method])
          end
        end

        def object_path_by_class_with_base0(*args)
          object_path_by_class_without_base0(*args).gsub(/_url\z/, '_path')
        end
      end
    end
  end
end

require 'eac_rails_utils/links_helper'
patch = ::EacRailsBase0::Patches::EacRailsUtilsLinksHelper
target = ::EacRailsUtils::LinksHelper
target.send(:include, patch) unless target.included_modules.include?(patch)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
eac_rails_base0-0.30.2 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.30.1 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.30.0 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.29.3 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.29.2 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb