stateful_link 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,10 +3,10 @@ module StatefulLink
3
3
  # Generates stateful link to something.
4
4
  #
5
5
  # Options:
6
- # :inactive - template of inactive state
7
- # :active - template of active state
8
- # :chosen - template of chosen state
9
- # :state - block to determine state (action_state called if none)
6
+ # :inactive - template of inactive state (block or string).
7
+ # :active - template of active state.
8
+ # :chosen - template of chosen state.
9
+ # :state - state (action_state called if none) - block, symbol or boolean
10
10
  #
11
11
  # Any option may be proc.
12
12
  #
@@ -21,7 +21,7 @@ module StatefulLink
21
21
  active = args.first
22
22
  chosen = args.second
23
23
  state = options[:state] || proc { action_state(active, chosen) }
24
- state = instance_exec(&state)
24
+ state = state.is_a?(Proc) ? instance_exec(&state) : state
25
25
  state = :active if state == true
26
26
  state = :inactive if state == false
27
27
  current = options[state]
@@ -1,3 +1,3 @@
1
1
  module StatefulLink
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stateful_link
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Victor Sokolov