okay 9.0.0 → 10.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/okay/simple_opts.rb +28 -0
- data/lib/okay/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3abf8b39842bc201721061189ca61e036198780c60e1d01a1c6b5434b8c6796c
|
4
|
+
data.tar.gz: effbb2d734973d1c0c0c33e59f027246212d3f79fd734c524274a5454a27e14b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: faf52f42bc463b31b73e4b8ccaa680d971c1a4b874cb27321248ee4e337da88e0b73ae330693c64ee740ea23229e22a36ed833f412a7bee77e1bf2aaa3823a4c
|
7
|
+
data.tar.gz: c43961b19116e262ce15cd514a2f4e8212031fe2aa9d8454e68327ecf40e2b9c9dfe775b2159889478a40932d89ce1b11a04376da694643615e1dcd759107a9d
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "optparse"
|
4
|
+
|
5
|
+
##
|
6
|
+
# An OptionParser wrapper providing a few convenience functions.
|
7
|
+
class SimpleOpts < OptionParser
|
8
|
+
def initialize(*args, defaults: nil)
|
9
|
+
super(*args)
|
10
|
+
@okay_options = defaults || {}
|
11
|
+
end
|
12
|
+
|
13
|
+
# simple(..., :a)
|
14
|
+
# simple(..., :b)
|
15
|
+
# ==
|
16
|
+
# options = {}
|
17
|
+
# on(...) { |val| options[:a] = val }
|
18
|
+
# on(...) { |val| options[:b] = val }
|
19
|
+
def simple(*args)
|
20
|
+
key = args.pop
|
21
|
+
on(*args) { |*x| @okay_options[key] = x[0] }
|
22
|
+
end
|
23
|
+
|
24
|
+
def parse(args)
|
25
|
+
parse!(args.dup)
|
26
|
+
@okay_options
|
27
|
+
end
|
28
|
+
end
|
data/lib/okay/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: okay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 10.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ellen Marie Dash
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- lib/okay/default.rb
|
121
121
|
- lib/okay/graphql.rb
|
122
122
|
- lib/okay/http.rb
|
123
|
+
- lib/okay/simple_opts.rb
|
123
124
|
- lib/okay/template.rb
|
124
125
|
- lib/okay/version.rb
|
125
126
|
- lib/okay/warning_helpers.rb
|