menuable 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0c4ea54013a825585c4b87cdf3e25e54d82c04b1b6aab36b436ac2cc588a3d1
4
- data.tar.gz: 2b635cf422c7eed2068b5e1fad5fcb0518ca1f8402f7237a04971dab84f5ca0f
3
+ metadata.gz: f3e428de3e6e6e19e26e5eebbdf163677fc2dac048610e572a0c1c9e8473375f
4
+ data.tar.gz: abdd56584c6ceeb8854dceea90bad7c41134b28c3211c2d4ae5a6a99c4415e0f
5
5
  SHA512:
6
- metadata.gz: 650d34d9d2699828ea17994775f6f9230e1229bb853c2bbd87d354871a4e7d7ce83e26f4bc897e91e5a61e3663264511240a4a0fbeee400dd6351b20e7e30759
7
- data.tar.gz: c5625b3c58e74e01a09f803088cd9b443113284d769fe6987bea16e3f461d9a5b73b4dad95c400c75132eabcdac028852b614441ae04e552d93bc186e672bf7a
6
+ metadata.gz: 410d422e140b3e3f922a763df3086cf982c31cb18e5dcda9d4203189a383ef7af55bb1ac18922fdf1853849eb2dda14ae9e4f241941979266ea449d97f44a6a6
7
+ data.tar.gz: b1c01be9f31432e70d7b5667361b54ed414ab9b19d09f01f74ca6cb672af7c31c4d869560f422ad2c53150d67dcb3af0a1c4b36e2dda3ecefa45789ef489233e
data/.rubocop.yml CHANGED
@@ -1,5 +1,11 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rake
4
+ - rubocop-rspec
5
+
1
6
  AllCops:
2
7
  TargetRubyVersion: 3.2.2
8
+ NewCops: enable
3
9
 
4
10
  Style/StringLiterals:
5
11
  Enabled: true
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Menuable
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
data/lib/menuable.rb CHANGED
@@ -3,12 +3,15 @@
3
3
  require_relative "menuable/version"
4
4
  require "active_support/all"
5
5
 
6
+ #
7
+ # Menuable is a module for dynamically generating sidemenus
8
+ #
6
9
  module Menuable
7
10
  extend ActiveSupport::Concern
8
11
 
9
12
  class_methods do
10
- def resource(resource_name, **options, &block)
11
- resources(resource_name, single: true, **options, &block)
13
+ def resource(resource_name, **options, &)
14
+ resources(resource_name, single: true, **options, &)
12
15
  end
13
16
 
14
17
  def resources(resource_name, single: false, **options, &block)
@@ -27,6 +30,9 @@ module Menuable
27
30
  end
28
31
  end
29
32
 
33
+ #
34
+ # Value to set from controller
35
+ #
30
36
  class MenuDefinition
31
37
  class_attribute :options
32
38
  class_attribute :resource_name
@@ -52,6 +58,10 @@ module Menuable
52
58
  end
53
59
  end
54
60
 
61
+ #
62
+ # A class for binding with view_content to convert the settings defined in yaml
63
+ # into something that can actually be used
64
+ #
55
65
  class MenuContext
56
66
  attr_reader :context
57
67
 
@@ -89,7 +99,7 @@ module Menuable
89
99
  path || config[:path] || "/"
90
100
  end
91
101
 
92
- def active?(menu)
102
+ def active?(menu) # rubocop:todo Metrics/MethodLength
93
103
  case menu
94
104
  in items:
95
105
  items.any? do |item|
@@ -115,6 +125,9 @@ module Menuable
115
125
  end
116
126
  end
117
127
 
128
+ #
129
+ # The actual state of the definition body that reads YAML
130
+ #
118
131
  class Menu
119
132
  def initialize(namespace, path) # rubocop:todo Metrics/MethodLength, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
120
133
  extract_namespace = lambda do |name|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: menuable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masa (Aileron inc)
@@ -9,7 +9,21 @@ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
11
  date: 2023-07-18 00:00:00.000000000 Z
12
- dependencies: []
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: 'This library provides menu.yml and controller macros to manage routes
14
28
  and sidebar implementations when implementing management functions in rails.
15
29
 
@@ -38,6 +52,7 @@ metadata:
38
52
  homepage_uri: https://github.com/aileron-inc/menuable
39
53
  source_code_uri: https://github.com/aileron-inc/menuable
40
54
  changelog_uri: https://github.com/aileron-inc/menuable
55
+ rubygems_mfa_required: 'true'
41
56
  post_install_message:
42
57
  rdoc_options: []
43
58
  require_paths: