actionnav 1.1.0 → 1.2.0

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: a9b254bf96dcf8eacff52b8b4b22c2ce2ed63b88716893b850823fe330fbc035
4
- data.tar.gz: a4faf9c7831fd7b99bd5e10de157bb6ca2ebd73a712d713fb66fcb397c0db324
3
+ metadata.gz: b42909b04fcc4c81f604aaee142e8fbd27371f7c59568f0a0acf695c6610843a
4
+ data.tar.gz: ee1bd67e110480eaab050f7dc51b3ad4a01fb5e838a8cf4e75d59a014ac15588
5
5
  SHA512:
6
- metadata.gz: 91e146df497b9cf2d8edcbca6eafd6a9d9c6c7d14cc181f3c149c44654aba081ecfb4a2733cfc6d5a5e2305ca188c251762b0a28ffc006c6c8763ad27c268610
7
- data.tar.gz: 956788e97fef1ca4c5b2da29a355d858771a43e1baece5fbfc22af82fba275d834acc620c2a0951283e82f41b0f718eaa64cd62cea4a96f39e7fd6dc0fdc4e68
6
+ metadata.gz: 332bbcf82df0fb68b1c13a6a7f27387ad18734f03d07dd325838e792ecdc79ad7e54299551634ef3c1d4d5a62d94a8a69feff7cbf00ac5c30d12c153f8e331cd
7
+ data.tar.gz: 38eaefc923ba32c4c66effb9b2dcff8d69a8ccbfddb3e6d40f1d8de200bcfee01ebd63efa66a5261d007f5a153f6e70a4782deae4c26dcd863d9cff20ae9ac90
@@ -12,6 +12,7 @@ module ActionNav
12
12
  def initialize(controller)
13
13
  @controller = controller
14
14
  @active_paths = []
15
+ @context = {}
15
16
  end
16
17
 
17
18
  # The controller that initialized this navigation.
@@ -20,6 +21,11 @@ module ActionNav
20
21
  attr_reader :controller
21
22
  attr_reader :active_paths
22
23
 
24
+ # The context for this navigation.
25
+ #
26
+ # @return [Hash]
27
+ attr_reader :context
28
+
23
29
  # Return a full list of items for this instance as
24
30
  # instances.
25
31
  #
@@ -50,6 +56,15 @@ module ActionNav
50
56
  end
51
57
  end
52
58
 
59
+ # Add context to this navigation.
60
+ #
61
+ # @param key [Symbol]
62
+ # @param value [Object]
63
+ # @return [Hash]
64
+ def add_context(key, value)
65
+ @context[key] = value
66
+ end
67
+
53
68
  # Add a new item to this navigation
54
69
  #
55
70
  # @param id [Symbol]
@@ -77,7 +77,7 @@ module ActionNav
77
77
 
78
78
  def parse(item, default = nil)
79
79
  if item.is_a?(Proc)
80
- @base.controller.instance_eval(&item)
80
+ @base.controller.instance_exec(@base.context, &item)
81
81
  elsif item.is_a?(Hash)
82
82
  item
83
83
  elsif item
@@ -1,3 +1,3 @@
1
1
  module ActionNav
2
- VERSION = "1.1.0" # x-release-please-version
2
+ VERSION = "1.2.0" # x-release-please-version
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionnav
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-13 00:00:00.000000000 Z
11
+ date: 2024-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  requirements: []
63
- rubygems_version: 3.3.26
63
+ rubygems_version: 3.3.27
64
64
  signing_key:
65
65
  specification_version: 4
66
66
  summary: This gem provides a friendly way to manage application navigation.