gmt 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gmt.rb +16 -7
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84cd995c50a9a918aadf655f83b8be85f297f391f456cd4fe1833db79367bfb0
4
- data.tar.gz: 7f88fb3453566749affca18d1ec2afe0242e5ff2b50edfd34795572213a798da
3
+ metadata.gz: add57f0a400ff02baf95838b30287a290923d1a56e0ed528f0687649eb173a7d
4
+ data.tar.gz: d8e40fad79ec4dffe5973038fc963da69cbc8e9538ac6c0440971277fe47e010
5
5
  SHA512:
6
- metadata.gz: c4d22fae62200c0976471c93f5b9dadbfafe7368b14e6ef5b344d0f77267d74c28e6db459e20b4740991792ed3545267870767e9048a33802736844253b0d0ec
7
- data.tar.gz: 2f59eea2cead5e5383ebf5ffcb828a4d1e6c3f5913b44682dfcd6c52a118f24d3f111da1af9ebf9eff5c7b36f5ed74f25ce7e11e4c1adf945a4e3a6487c466a2
6
+ metadata.gz: f820a71b95aee0f2e3ef4306c771ba3e3449f4be109f505c84dadbe396ea955a2914dbcba1bc5bf055f2f6e9985d76ec882e951e1460123babde15e2b4850a90
7
+ data.tar.gz: 59fe46c4f7dd9aa045857a9129c948440d56e8209bbbe20848bf6f5f47c7b0ba79c8466155af3a6fd4e9b371046a03941c6663285e60d73b899e1f95f7989fcd
data/lib/gmt.rb CHANGED
@@ -145,7 +145,7 @@ class GMT
145
145
  # @see http://gmt.soest.hawaii.edu/doc/latest/$1.html
146
146
  def wrapper_ps(method)
147
147
  define_method(method) do |*args, **opts|
148
- args, opts = nilargify(args, opts)
148
+ args, opts = arg_opt_normalise(args, opts)
149
149
  coerce_postscript_options!(opts)
150
150
  coerce_append_option!(opts)
151
151
  self.send(api_function(method), *args, options_as_pairs(opts))
@@ -160,7 +160,7 @@ class GMT
160
160
  # @see http://gmt.soest.hawaii.edu/doc/latest/$1.html
161
161
  def wrapper_other(method)
162
162
  define_method(method) do |*args, **opts|
163
- args, opts = nilargify(args, opts)
163
+ args, opts = arg_opt_normalise(args, opts)
164
164
  coerce_append_option!(opts)
165
165
  self.send(api_function(method), *args, options_as_pairs(opts))
166
166
  end
@@ -185,13 +185,22 @@ class GMT
185
185
  [method.to_s, 'c'].join('_').to_sym
186
186
  end
187
187
 
188
- # convert symbol arguments to nil-valued options, so
189
- # nilargify(['a', :b], {c: 'd'}) -> [['a'], {b: nil, c: 'd'}]
190
-
191
- def nilargify(args, opts)
188
+ # convert symbol arguments to nil-valued options, and
189
+ # call :to_s on the remaining arguments, so
190
+ #
191
+ # arg_opt_normalise(['a', :b, Pathname('/c')], {d: 'e'})
192
+ #
193
+ # becomes
194
+ #
195
+ # [['a', '/c'], {b: nil, d: 'e'}]
196
+ #
197
+ # returns the normalised arguments and options, does not
198
+ # modify the inputs
199
+
200
+ def arg_opt_normalise(args, opts)
192
201
  syms, strs = args.partition { |x| x.is_a? Symbol }
193
202
  syms.each { |sym| opts[sym] = nil }
194
- [strs, opts]
203
+ [strs.map(&:to_s), opts]
195
204
  end
196
205
 
197
206
  # for GMT modules which produce PostScript, convert the
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gmt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - J.J. Green
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-17 00:00:00.000000000 Z
11
+ date: 2018-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler