Sha256: 6ecf441fa3e42227e6ed31d604f640c870464c2786ea74d79ff26f6df5db686c
Contents?: true
Size: 837 Bytes
Versions: 11
Compression:
Stored size: 837 Bytes
Contents
# frozen_string_literal: true require 'eac_rails_utils/menus/node' require 'eac_ruby_utils/core_ext' module EacRailsUtils module Menus class Action < ::EacRailsUtils::Menus::Node common_constructor :path, :parent_group, super_args: -> { [parent_group] } do self.path = [parent_group.path_first_node] + path if path.size < 2 end # @return [Symbol] def key path.map(&:to_s).join('_').to_sym end # @param view [ActionView::Base] # @return [Array] def to_dropdown_menu_entries(view) [view_path(view)] end # @param view [ActionView::Base] # @return [String] def view_path(view) path.each_with_index.inject(view) do |a, e| a.send(e[1] == path.count - 1 ? "#{e[0]}_path" : e[0]) end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems