action_command 0.1.7 → 0.1.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8cb30a6e5bd542c0de8e3400176d64c1d6055849
4
- data.tar.gz: af5f656c52f4cd5b69ae79569e07601bc7e51647
3
+ metadata.gz: 3ac741bfd947eab14a520ca140441c04e88bb93a
4
+ data.tar.gz: cd8e7c5f4f993c3072a74e9a7d7660c71cdaa129
5
5
  SHA512:
6
- metadata.gz: 5575cb4d24875b5f65b91ea6c50e3f11fd2e9680f073ae6ff191b51b6d04470d4420950f449f65b1ffbc6aa52f7c13e1c59cd5f3995dc85c2da17af11cea9c98
7
- data.tar.gz: 2c0c15795a4b5755c50dae08e4ebd1e26520ae37321b385ba91737776bb3cdefea005e6222b168c33cbfc089c9d5af954dadee7b7c18e78e3e19c6ffc515cca4
6
+ metadata.gz: 08d0f084fe0ae9c451ae3a119fbf54f5712b6bf6187a05c02aa69455950e9a9b11639200c3e99b3a8120009b96e529188e388af69bf4414a1ab3504a0bcbcd56
7
+ data.tar.gz: 3f7475cc8e7c25ee6cd9b74b8c681b453e370aaaafa5c1fe9b517b36b0575eb9b9948e044df91fe5eb453a6a26e49d78e925c531b179d912235b4371b1e4d072
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- action_command (0.1.7)
4
+ action_command (0.1.8)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -15,6 +15,16 @@ module ActionCommand
15
15
  return cls.find(item) if item.is_a? Integer
16
16
  return yield(item)
17
17
  end
18
+
19
+ # Used for cases where you might have a active record object, or an integer
20
+ # id, or some kind of string identifier. If it is an active record object,
21
+ # this will return its id. If it is an integer, it will return it. Otherwise,
22
+ # it will pass the string to yield, which can lookup the object
23
+ def self.find_id(cls, item)
24
+ return item.id if item.is_a? cls
25
+ return item if item.is_a? Integer
26
+ return yield(item)
27
+ end
18
28
  end
19
29
 
20
30
  end
@@ -1,4 +1,4 @@
1
1
  module ActionCommand
2
2
  # Version of this Gem
3
- VERSION = '0.1.7'.freeze
3
+ VERSION = '0.1.8'.freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_command
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Jones