optbind 0.5.1 → 0.5.2

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: e128bc6975c80a8f1261eca7bdf38743c2ad60ce
4
- data.tar.gz: d4925a1d2d029ebbe05aba718f836b4b962b7494
3
+ metadata.gz: 406cb77b52b22a6b38f98aaa1fc0fd54923466b9
4
+ data.tar.gz: a457644f6382d8c985a14794d48b58a8f693c591
5
5
  SHA512:
6
- metadata.gz: 3ae1e8391bec9d3225eccf45093af663de0fce4a23f4ec0b994544128c68623a83f5d4d66b5b7135650aa3bb49980fbc56a77f5e592c43ebfa5bd6331076c1c0
7
- data.tar.gz: b922fd19657c6be4def0a5f6357cf06df63a4b5985bdab264194c4dafb36dbaed35ee75ddf8a052c743ca3a4b8c2b1832aac220eb413b25918b0d3430724e19a
6
+ metadata.gz: ed357b08d95f15f13e7d710837f5fe0df3a50fc1cf79cf050f26510b4bda5653bc13982cdc7277a7d43a5453621a3ff8df5011c8fa2031d36596e5aa2ece553d
7
+ data.tar.gz: 8dad1ff07d076d5c60ebcf3b413b7acffe3e690f0fb5a1f4eecb78bcc7bff009bbd6f1110a7a61f58cf76a479e5932ceae666385ab8dcd6e0decfd19a12c5f4e
@@ -1,3 +1,11 @@
1
+ ## 0.5.1
2
+
3
+ * Add extension for automatic defaults description
4
+
5
+ * Add missing required dependencies
6
+
7
+ *Pavol Zbell*
8
+
1
9
  ## 0.5.0
2
10
 
3
11
  * Support parsing of options with typed array value and multiple typed arguments
data/README.md CHANGED
@@ -256,6 +256,12 @@ end
256
256
 
257
257
  ### Extensions
258
258
 
259
+ Use `optbind/ext` shortcut to load option binder with all available extensions at once:
260
+
261
+ ```ruby
262
+ require 'optbind/ext'
263
+ ```
264
+
259
265
  Several available extensions include:
260
266
 
261
267
  #### Default
data/TODO.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # TODOS
2
2
 
3
- - make a way to include all exts at once like require 'optbind/all'
4
3
  - test against special cases for multiple args like 'a <ids...>' with '--x 1'
5
- - add optbind/defaults from extise as separate package, required on demand
6
4
 
7
5
  - add support for arrays of int -> <x:Array:Integer> and <x:Integer>...
8
6
  - add support for ranges on `OptionParser` level
@@ -232,7 +232,6 @@ class OptionBinder
232
232
  a = @argument_definitions[i]
233
233
  raise TooManyArguments unless a
234
234
  raise MissingArguments if a[:opts].include?(:REQUIRED) && r.empty?
235
- # TODO test escapes!
236
235
  "--#{i}=#{r * ','}" if a[:opts].include?(:REQUIRED) || !(r.empty? || r.find(&:empty?))
237
236
  end
238
237
  @argument_parser.order! p
@@ -249,7 +248,7 @@ class OptionBinder
249
248
  o = opts.dup
250
249
  t = o.delete o.find { |a| a != Array && a.is_a?(Module) }
251
250
  o << Array unless o.include? Array
252
- return o, handler unless t
251
+ return o, handler if t == nil || t == String
253
252
  require 'optbind/handler'
254
253
  return o, -> (a) { (handler || -> (r) { r }).call listed_as(t).call a }
255
254
  end
@@ -0,0 +1,5 @@
1
+ require 'optbind'
2
+ require 'optbind/default'
3
+ require 'optbind/handler'
4
+ require 'optbind/mode'
5
+ require 'optbind/type'
@@ -1,3 +1,3 @@
1
1
  class OptBind
2
- VERSION = '0.5.1'
2
+ VERSION = '0.5.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optbind
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavol Zbell
@@ -52,6 +52,7 @@ files:
52
52
  - TODO.md
53
53
  - lib/optbind.rb
54
54
  - lib/optbind/default.rb
55
+ - lib/optbind/ext.rb
55
56
  - lib/optbind/handler.rb
56
57
  - lib/optbind/mode.rb
57
58
  - lib/optbind/type.rb