gmt 0.0.4 → 0.0.5

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 +33 -38
  3. metadata +15 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4691c0f699ea4423dd732be0e007565dac9fde44
4
- data.tar.gz: f122cc4a4c66faeaa08aa461cc9dc032b010c1cc
3
+ metadata.gz: d5a65a755a31688499a920ea9a2607b532559ff1
4
+ data.tar.gz: 5485b4fe71d63e8042db9fd0f459ba5ec0b4bccd
5
5
  SHA512:
6
- metadata.gz: 05dfc99cebe098144c8953a8802c04a1403a3491be8460cfafd9c002f269f411011bcecd732923ef3c785cfeea5c0dcdf2e79b7156fb5959a835bd2faa396736
7
- data.tar.gz: 7199fdb657e5e7b4df5f6dcdc6eac413a3deeb33dc8cbd99f1ab0792d870c3715154378ea23077b55b87833dacd871eb81e201d2086429d4651dbfc6bee993a5
6
+ metadata.gz: 5f74d327f2ec1f15b2444eb61dfdab5fbcf4c1732e4e9164838a79d8108146881b87645d27ad427e304b6b8e3e70b7fa85568221fb6858888db78a3fcced3e52
7
+ data.tar.gz: 426b2a729293828d069eb78c540adc689db325e7b87b4415ab826de4f13cb897d2bcbcf1359080985d3730febe3b3a2a373e4de86ee381262e3fdb2cd336e92e
data/lib/gmt.rb CHANGED
@@ -4,17 +4,10 @@
4
4
 
5
5
  class GMT
6
6
 
7
- private
8
-
9
- PS_METHODS = [:pstext, :psxy]
10
- NON_PS_METHODS = [:makecpt]
11
-
12
- def method_c(method)
13
- [method.to_s, 'c'].join('_').to_sym
14
- end
15
-
16
7
  class << self
17
8
 
9
+ private
10
+
18
11
  def opts_normalise(options)
19
12
  file = options.delete(:file)
20
13
  position = options.delete(:position)
@@ -36,44 +29,46 @@ class GMT
36
29
  end
37
30
  end
38
31
 
39
- end
40
-
41
- public
42
-
43
- ##
44
- # :method: pstext
45
- # Plot text strings on maps
46
- # :call-seq:
47
- # pstext(*files, options)
48
-
49
- ##
50
- # :method: psxy
51
- # Plot symbols, polygons, and lines on maps
52
- # :call-seq:
53
- # psxy(*files, options)
32
+ def method_c(method)
33
+ [method.to_s, 'c'].join('_').to_sym
34
+ end
54
35
 
55
- PS_METHODS.each do |method|
36
+ # @macro [attach] wrapper_ps
37
+ # @method $1(*files, options)
38
+ # @param [Array<String>] files The input files
39
+ # @param [Hash] options The GMT command-line options in hash form
40
+ # @return [Boolean] +true+ on success
41
+ def wrapper_ps(method)
42
+ define_method(method) do |*files, options|
43
+ self.send(GMT.send(:method_c, method),
44
+ *files,
45
+ GMT.send(:opts_normalise, options))
46
+ end
47
+ end
56
48
 
57
- define_method(method) do |*files, options|
58
- self.send(method_c(method),
59
- *files, GMT.opts_normalise(options))
49
+ # @macro [attach] wrapper_other
50
+ # @method $1(*files, options)
51
+ # @param [Array<String>] files The input files
52
+ # @param [Hash] options The GMT command-line options in hash form
53
+ # @return [Boolean] +true+ on success
54
+ def wrapper_other(method)
55
+ define_method(method) do |*args|
56
+ self.send(GMT.send(:method_c, method), *args)
57
+ end
60
58
  end
61
59
 
62
60
  end
63
61
 
64
- ##
65
- # :method: makecpt
66
- # Make color palette tables
67
- # :call-seq:
68
- # makecpt(options)
62
+ public
69
63
 
70
- NON_PS_METHODS.each do |method|
64
+ # Plot text strings on maps
65
+ wrapper_ps :pstext
71
66
 
72
- define_method(method) do |*args|
73
- self.send(method_c(method), *args)
74
- end
67
+ # Plot symbols, polygons, and lines on maps
68
+ wrapper_ps :psxy
75
69
 
76
- end
70
+ # Make color palette tables
71
+ wrapper_other :makecpt
77
72
 
78
73
  end
79
74
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gmt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - J.J. Green
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: yard
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.8'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.8'
55
69
  description: |
56
70
  A Ruby extension for the Generic Mapping Tools (GMT)
57
71
  cartographic toolset (work-in-progress).