lab42_rgxargs 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
  SHA256:
3
- metadata.gz: 3879a325fa817a79a35ca494b7d7550aac9d6d6a25702d7ab07efbbf51d2c3d1
4
- data.tar.gz: 7446e1f864db187211f4327222eb3fad7d6f6e20abd5ebaecdd7a6185039600f
3
+ metadata.gz: 859bcfceec315a00418253c045cb8819276bafd306e52c36a9f3c1f2f0c657aa
4
+ data.tar.gz: 1cb197a190eada29279019ef914e98af7015589a8aacfd1e16e3a4c728615892
5
5
  SHA512:
6
- metadata.gz: 9ac9b5cf9ed52197f16c647c5d5202e0a47efbcc98a5ed5ba89b8bebaa81eb4966f06f9b681ad5b0186939c715c45f1e1c3c14cdb03658724778ab55b614192e
7
- data.tar.gz: 373b64cf35bd6949585afbbd8123ff309f09239d1ad2090156c211862f8b2159ff07fed9478bb43eabf63a12f978145c1ef064e27c34572a637de2139c0cbaa8
6
+ metadata.gz: c8c31ee9df616a66e6a0463a3778b227395cee9acabed1203d4ce46d840208d65829d9c4b48218453cd74d8f770e03538a737d5c6946cdb6486872fd964cd320
7
+ data.tar.gz: d817a9984f1853028979f179f97fd4b421a58deed2b081fa359f35351e73209b7183aabd1cf5466b86e4e0a20383d7f0b9927d369645ceaf0a47731085e5af7b
@@ -20,10 +20,12 @@ module Lab42
20
20
  attr_reader :allowed, :args, :conversions, :defaults, :defined_rules, :errors, :options, :required, :syntaxes
21
21
 
22
22
 
23
- def add_conversion(param, conversion, required=nil, &block)
23
+ def add_conversion(param, conversion=nil, required=nil, &block)
24
24
  case conversion
25
25
  when Symbol
26
26
  _add_symbolic_conversion(param, conversion, required)
27
+ when NilClass
28
+ _add_simple_conversion(param, block)
27
29
  else
28
30
  _add_proc_conversion(param, conversion, block, required)
29
31
  end
@@ -95,6 +97,12 @@ module Lab42
95
97
  end
96
98
  end
97
99
 
100
+ def _add_simple_conversion(param, block)
101
+ Array(param).each do |para|
102
+ conversions[para] = block
103
+ end
104
+ end
105
+
98
106
  def _add_symbolic_conversion(param, conversion, required)
99
107
  Array(param).each do |para|
100
108
  @required.add para if required == :required
@@ -1,5 +1,5 @@
1
1
  module Lab42
2
2
  class Rgxargs
3
- VERSION = "0.1.7"
3
+ VERSION = "0.1.8"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lab42_rgxargs
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
  - Robert Dober