ffi-geos 2.1.0 → 2.3.1

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.
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,99 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 10000`
3
+ # on 2022-02-25 00:43:48 UTC using RuboCop version 1.24.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ Lint/BinaryOperatorWithIdenticalOperands:
11
+ Exclude:
12
+ - 'test/geometry_tests.rb'
13
+
14
+ # Offense count: 6
15
+ # Configuration parameters: IgnoredMethods, CountRepeatedAttributes, Max.
16
+ Metrics/AbcSize:
17
+ Exclude:
18
+ - 'lib/ffi-geos/coordinate_sequence.rb'
19
+ - 'lib/ffi-geos/line_string.rb'
20
+ - 'lib/ffi-geos/utils.rb'
21
+ - 'test/geometry_tests.rb'
22
+
23
+ # Offense count: 2
24
+ # Configuration parameters: CountComments, Max, CountAsOne.
25
+ Metrics/ClassLength:
26
+ Exclude:
27
+ - 'lib/ffi-geos/coordinate_sequence.rb'
28
+ - 'lib/ffi-geos/geometry.rb'
29
+
30
+ # Offense count: 3
31
+ # Configuration parameters: IgnoredMethods, Max.
32
+ Metrics/CyclomaticComplexity:
33
+ Exclude:
34
+ - 'lib/ffi-geos/coordinate_sequence.rb'
35
+ - 'lib/ffi-geos/tools.rb'
36
+
37
+ # Offense count: 1
38
+ # Configuration parameters: CountComments, Max, CountAsOne.
39
+ Metrics/ModuleLength:
40
+ Exclude:
41
+ - 'lib/ffi-geos.rb'
42
+
43
+ # Offense count: 1
44
+ # Configuration parameters: Max, CountKeywordArgs, MaxOptionalParameters.
45
+ Metrics/ParameterLists:
46
+ Exclude:
47
+ - 'lib/ffi-geos/utils.rb'
48
+
49
+ # Offense count: 4
50
+ # Configuration parameters: IgnoredMethods, Max.
51
+ Metrics/PerceivedComplexity:
52
+ Exclude:
53
+ - 'lib/ffi-geos/coordinate_sequence.rb'
54
+ - 'lib/ffi-geos/tools.rb'
55
+ - 'test/geometry_tests.rb'
56
+
57
+ # Offense count: 8
58
+ Naming/AccessorMethodName:
59
+ Exclude:
60
+ - 'lib/ffi-geos/point.rb'
61
+ - 'lib/ffi-geos/wkb_writer.rb'
62
+ - 'lib/ffi-geos/wkt_writer.rb'
63
+
64
+ # Offense count: 1
65
+ # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
66
+ # CheckDefinitionPathHierarchyRoots: lib, spec, test, src
67
+ # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
68
+ Naming/FileName:
69
+ Exclude:
70
+ - 'lib/ffi-geos.rb'
71
+
72
+ # Offense count: 2
73
+ # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
74
+ # NamePrefix: is_, has_, have_
75
+ # ForbiddenPrefixes: is_, has_, have_
76
+ # AllowedMethods: is_a?
77
+ # MethodDefinitionMacros: define_method, define_singleton_method
78
+ Naming/PredicateName:
79
+ Exclude:
80
+ - 'lib/ffi-geos/coordinate_sequence.rb'
81
+ - 'lib/ffi-geos/geometry.rb'
82
+
83
+ # Offense count: 2
84
+ # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers.
85
+ # SupportedStyles: snake_case, normalcase, non_integer
86
+ # AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
87
+ Naming/VariableNumber:
88
+ Exclude:
89
+ - 'lib/ffi-geos.rb'
90
+ - 'lib/ffi-geos/geometry.rb'
91
+
92
+ # Offense count: 4
93
+ # Configuration parameters: AllowedMethods.
94
+ # AllowedMethods: respond_to_missing?
95
+ Style/OptionalBooleanParameter:
96
+ Exclude:
97
+ - 'lib/ffi-geos/geometry.rb'
98
+ - 'test/wkb_reader_tests.rb'
99
+ - 'test/wkb_writer_tests.rb'
data/FUNDING.yml ADDED
@@ -0,0 +1,2 @@
1
+ github:
2
+ - dark-panda
data/Gemfile CHANGED
@@ -8,14 +8,11 @@ gem 'guard'
8
8
  gem 'guard-minitest'
9
9
  gem 'minitest'
10
10
  gem 'minitest-reporters'
11
- gem 'rake', '~> 10.0'
12
- gem 'rdoc', '~> 3.12'
11
+ gem 'rake'
12
+ gem 'rdoc'
13
13
  gem 'rubocop', require: false
14
- gem 'simplecov', '~> 0.17.0', require: false
15
-
16
- platforms :rbx do
17
- gem 'rubinius-developer_tools'
18
- gem 'rubysl', '~> 2.0'
19
- end
14
+ gem 'rubocop-minitest', require: false
15
+ gem 'simplecov', require: false
16
+ gem 'simplecov_json_formatter', require: false
20
17
 
21
18
  instance_eval File.read('Gemfile.local') if File.exist?('Gemfile.local')
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2020 J Smith <dark.panda@gmail.com>
1
+ Copyright (c) 2010-2021 J Smith <dark.panda@gmail.com>
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person
4
4
  obtaining a copy of this software and associated documentation
data/ffi-geos.gemspec CHANGED
@@ -7,6 +7,8 @@ Gem::Specification.new do |s|
7
7
  s.version = Geos::VERSION
8
8
 
9
9
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
10
+ s.required_ruby_version = '>= 2.5'
11
+
10
12
  s.authors = ['J Smith']
11
13
  s.description = 'An ffi wrapper for GEOS, a C++ port of the Java Topology Suite (JTS).'
12
14
  s.summary = s.description
@@ -22,4 +24,7 @@ Gem::Specification.new do |s|
22
24
  s.require_paths = ['lib']
23
25
 
24
26
  s.add_dependency('ffi', ['>= 1.0.0'])
27
+ s.metadata = {
28
+ 'rubygems_mfa_required' => 'true'
29
+ }
25
30
  end
@@ -36,7 +36,7 @@ module Geos
36
36
  end
37
37
  end
38
38
 
39
- def self.release(ptr) #:nodoc:
39
+ def self.release(ptr) # :nodoc:
40
40
  FFIGeos.GEOSBufferParams_destroy_r(Geos.current_handle_pointer, ptr)
41
41
  end
42
42
 
@@ -123,7 +123,7 @@ module Geos
123
123
  @z = CoordinateAccessor.new(self, 2)
124
124
  end
125
125
 
126
- def self.release(ptr) #:nodoc:
126
+ def self.release(ptr) # :nodoc:
127
127
  FFIGeos.GEOSCoordSeq_destroy_r(Geos.current_handle_pointer, ptr)
128
128
  end
129
129
 
@@ -287,7 +287,7 @@ module Geos
287
287
  RUBY
288
288
  end
289
289
 
290
- def snap_to_grid!(*args)
290
+ def snap_to_grid!(*args, **kwargs)
291
291
  grid = {
292
292
  offset_x: 0, # 1
293
293
  offset_y: 0, # 2
@@ -299,8 +299,8 @@ module Geos
299
299
 
300
300
  if args.length == 1 && args[0].is_a?(Numeric)
301
301
  grid[:size_x] = grid[:size_y] = grid[:size_z] = args[0]
302
- elsif args[0].is_a?(Hash)
303
- grid.merge!(args[0])
302
+ elsif !kwargs.empty?
303
+ grid.merge!(kwargs)
304
304
  end
305
305
 
306
306
  grid[:size_x] = grid[:size_y] = grid[:size_z] = grid[:size] if grid[:size]
@@ -321,11 +321,11 @@ module Geos
321
321
  end
322
322
 
323
323
  length.times do |i|
324
- x[i] = ((x[i] - grid[:offset_x]) / grid[:size_x]).round * grid[:size_x] + grid[:offset_x] if grid[:size_x] != 0
324
+ x[i] = (((x[i] - grid[:offset_x]) / grid[:size_x]).round * grid[:size_x]) + grid[:offset_x] if grid[:size_x] != 0
325
325
 
326
- y[i] = ((y[i] - grid[:offset_y]) / grid[:size_y]).round * grid[:size_y] + grid[:offset_y] if grid[:size_y] != 0
326
+ y[i] = (((y[i] - grid[:offset_y]) / grid[:size_y]).round * grid[:size_y]) + grid[:offset_y] if grid[:size_y] != 0
327
327
 
328
- z[i] = ((z[i] - grid[:offset_z]) / grid[:size_z]).round * grid[:size_z] + grid[:offset_z] if has_z? && grid[:size_z] != 0
328
+ z[i] = (((z[i] - grid[:offset_z]) / grid[:size_z]).round * grid[:size_z]) + grid[:offset_z] if has_z? && grid[:size_z] != 0
329
329
  end
330
330
 
331
331
  cs = remove_duplicate_coords
@@ -334,7 +334,7 @@ module Geos
334
334
  self
335
335
  end
336
336
 
337
- def snap_to_grid(*args)
337
+ def snap_to_grid(*args, **)
338
338
  dup.snap_to_grid!(*args)
339
339
  end
340
340
 
@@ -353,17 +353,17 @@ module Geos
353
353
  y = self.y[i]
354
354
  z = self.z[i]
355
355
 
356
- self.x[i] = options[:afac] * x + options[:bfac] * y + options[:cfac] * z + options[:xoff]
357
- self.y[i] = options[:dfac] * x + options[:efac] * y + options[:ffac] * z + options[:yoff]
358
- self.z[i] = options[:gfac] * x + options[:hfac] * y + options[:ifac] * z + options[:zoff]
356
+ self.x[i] = (options[:afac] * x) + (options[:bfac] * y) + (options[:cfac] * z) + options[:xoff]
357
+ self.y[i] = (options[:dfac] * x) + (options[:efac] * y) + (options[:ffac] * z) + options[:yoff]
358
+ self.z[i] = (options[:gfac] * x) + (options[:hfac] * y) + (options[:ifac] * z) + options[:zoff]
359
359
  end
360
360
  else
361
361
  length.times do |i|
362
362
  x = self.x[i]
363
363
  y = self.y[i]
364
364
 
365
- self.x[i] = options[:afac] * x + options[:bfac] * y + options[:xoff]
366
- self.y[i] = options[:dfac] * x + options[:efac] * y + options[:yoff]
365
+ self.x[i] = (options[:afac] * x) + (options[:bfac] * y) + options[:xoff]
366
+ self.y[i] = (options[:dfac] * x) + (options[:efac] * y) + options[:yoff]
367
367
  end
368
368
  end
369
369
 
@@ -395,8 +395,8 @@ module Geos
395
395
  gfac: 0,
396
396
  hfac: 0,
397
397
  ifac: 1,
398
- xoff: origin[0] - Math.cos(radians) * origin[0] + Math.sin(radians) * origin[1],
399
- yoff: origin[1] - Math.sin(radians) * origin[0] - Math.cos(radians) * origin[1],
398
+ xoff: origin[0] - (Math.cos(radians) * origin[0]) + (Math.sin(radians) * origin[1]),
399
+ yoff: origin[1] - (Math.sin(radians) * origin[0]) - (Math.cos(radians) * origin[1]),
400
400
  zoff: 0
401
401
  )
402
402
  end
@@ -455,9 +455,9 @@ module Geos
455
455
  dup.rotate!(radians)
456
456
  end
457
457
 
458
- def scale!(*args)
459
- x, y, z = if args.length == 1 && args[0].is_a?(Hash)
460
- args[0].values_at(:x, :y, :z)
458
+ def scale!(*args, **kwargs)
459
+ x, y, z = if !kwargs.empty?
460
+ kwargs.values_at(:x, :y, :z)
461
461
  elsif args.length.between?(1, 3)
462
462
  args.values_at(0...3)
463
463
  else
@@ -480,13 +480,13 @@ module Geos
480
480
  )
481
481
  end
482
482
 
483
- def scale(*args)
484
- dup.scale!(*args)
483
+ def scale(*args, **kwargs)
484
+ dup.scale!(*args, **kwargs)
485
485
  end
486
486
 
487
- def trans_scale!(*args)
488
- delta_x, delta_y, x_factor, y_factor = if args.length == 1 && args[0].is_a?(Hash)
489
- args[0].values_at(:delta_x, :delta_y, :x_factor, :y_factor)
487
+ def trans_scale!(*args, **kwargs)
488
+ delta_x, delta_y, x_factor, y_factor = if !kwargs.empty?
489
+ kwargs.values_at(:delta_x, :delta_y, :x_factor, :y_factor)
490
490
  elsif args.length.between?(1, 4)
491
491
  args.values_at(0...4)
492
492
  else
@@ -514,13 +514,13 @@ module Geos
514
514
  )
515
515
  end
516
516
 
517
- def trans_scale(*args)
518
- dup.trans_scale!(*args)
517
+ def trans_scale(*args, **kwargs)
518
+ dup.trans_scale!(*args, **kwargs)
519
519
  end
520
520
 
521
- def translate!(*args)
522
- x, y, z = if args.length == 1 && args[0].is_a?(Hash)
523
- args[0].values_at(:x, :y, :z)
521
+ def translate!(*args, **kwargs)
522
+ x, y, z = if !kwargs.empty?
523
+ kwargs.values_at(:x, :y, :z)
524
524
  elsif args.length.between?(1, 3)
525
525
  args.values_at(0...3)
526
526
  else
@@ -543,17 +543,17 @@ module Geos
543
543
  )
544
544
  end
545
545
 
546
- def translate(*args)
547
- dup.translate!(*args)
546
+ def translate(*args, **kwargs)
547
+ dup.translate!(*args, **kwargs)
548
548
  end
549
549
 
550
550
  protected
551
551
 
552
- def check_bounds(idx) #:nodoc:
552
+ def check_bounds(idx) # :nodoc:
553
553
  raise Geos::IndexBoundsError, 'Index out of bounds' if idx.negative? || idx >= length
554
554
  end
555
555
 
556
- def build_coordinate(n) #:nodoc:
556
+ def build_coordinate(n) # :nodoc:
557
557
  [
558
558
  get_x(n),
559
559
  (dimensions >= 2 ? get_y(n) : nil),
@@ -38,7 +38,7 @@ module Geos
38
38
  self.srid = source.srid
39
39
  end
40
40
 
41
- def self.release(ptr) #:nodoc:
41
+ def self.release(ptr) # :nodoc:
42
42
  FFIGeos.GEOSGeom_destroy_r(Geos.current_handle_pointer, ptr)
43
43
  end
44
44
 
@@ -83,9 +83,14 @@ module Geos
83
83
  CoordinateSequence.new(FFIGeos.GEOSGeom_getCoordSeq_r(Geos.current_handle_pointer, ptr), false, self)
84
84
  end
85
85
 
86
- def intersection(geom)
86
+ def intersection(geom, precision: nil)
87
87
  check_geometry(geom)
88
- cast_geometry_ptr(FFIGeos.GEOSIntersection_r(Geos.current_handle_pointer, ptr, geom.ptr), srid_copy: pick_srid_from_geoms(srid, geom.srid))
88
+
89
+ if precision
90
+ cast_geometry_ptr(FFIGeos.GEOSIntersectionPrec_r(Geos.current_handle_pointer, ptr, geom.ptr, precision), srid_copy: pick_srid_from_geoms(srid, geom.srid))
91
+ else
92
+ cast_geometry_ptr(FFIGeos.GEOSIntersection_r(Geos.current_handle_pointer, ptr, geom.ptr), srid_copy: pick_srid_from_geoms(srid, geom.srid))
93
+ end
89
94
  end
90
95
 
91
96
  if FFIGeos.respond_to?(:GEOSBufferWithParams_r)
@@ -139,14 +144,24 @@ module Geos
139
144
  cast_geometry_ptr(FFIGeos.GEOSConvexHull_r(Geos.current_handle_pointer, ptr), srid_copy: srid)
140
145
  end
141
146
 
142
- def difference(geom)
147
+ def difference(geom, precision: nil)
143
148
  check_geometry(geom)
144
- cast_geometry_ptr(FFIGeos.GEOSDifference_r(Geos.current_handle_pointer, ptr, geom.ptr), srid_copy: pick_srid_from_geoms(srid, geom.srid))
149
+
150
+ if precision
151
+ cast_geometry_ptr(FFIGeos.GEOSDifferencePrec_r(Geos.current_handle_pointer, ptr, geom.ptr, precision), srid_copy: pick_srid_from_geoms(srid, geom.srid))
152
+ else
153
+ cast_geometry_ptr(FFIGeos.GEOSDifference_r(Geos.current_handle_pointer, ptr, geom.ptr), srid_copy: pick_srid_from_geoms(srid, geom.srid))
154
+ end
145
155
  end
146
156
 
147
- def sym_difference(geom)
157
+ def sym_difference(geom, precision: nil)
148
158
  check_geometry(geom)
149
- cast_geometry_ptr(FFIGeos.GEOSSymDifference_r(Geos.current_handle_pointer, ptr, geom.ptr), srid_copy: pick_srid_from_geoms(srid, geom.srid))
159
+
160
+ if precision
161
+ cast_geometry_ptr(FFIGeos.GEOSSymDifferencePrec_r(Geos.current_handle_pointer, ptr, geom.ptr, precision), srid_copy: pick_srid_from_geoms(srid, geom.srid))
162
+ else
163
+ cast_geometry_ptr(FFIGeos.GEOSSymDifference_r(Geos.current_handle_pointer, ptr, geom.ptr), srid_copy: pick_srid_from_geoms(srid, geom.srid))
164
+ end
150
165
  end
151
166
  alias symmetric_difference sym_difference
152
167
 
@@ -157,10 +172,15 @@ module Geos
157
172
  # Calling without a geom argument is equivalent to calling unary_union when
158
173
  # using GEOS 3.3+ and is equivalent to calling union_cascaded in older
159
174
  # versions.
160
- def union(geom = nil)
175
+ def union(geom = nil, precision: nil)
161
176
  if geom
162
177
  check_geometry(geom)
163
- cast_geometry_ptr(FFIGeos.GEOSUnion_r(Geos.current_handle_pointer, ptr, geom.ptr), srid_copy: pick_srid_from_geoms(srid, geom.srid))
178
+
179
+ if precision
180
+ cast_geometry_ptr(FFIGeos.GEOSUnionPrec_r(Geos.current_handle_pointer, ptr, geom.ptr, precision), srid_copy: pick_srid_from_geoms(srid, geom.srid))
181
+ else
182
+ cast_geometry_ptr(FFIGeos.GEOSUnion_r(Geos.current_handle_pointer, ptr, geom.ptr), srid_copy: pick_srid_from_geoms(srid, geom.srid))
183
+ end
164
184
  elsif respond_to?(:unary_union)
165
185
  unary_union
166
186
  else
@@ -181,8 +201,12 @@ module Geos
181
201
 
182
202
  if FFIGeos.respond_to?(:GEOSUnaryUnion_r)
183
203
  # Available in GEOS 3.3+
184
- def unary_union
185
- cast_geometry_ptr(FFIGeos.GEOSUnaryUnion_r(Geos.current_handle_pointer, ptr), srid_copy: srid)
204
+ def unary_union(precision = nil)
205
+ if precision
206
+ cast_geometry_ptr(FFIGeos.GEOSUnaryUnionPrec_r(Geos.current_handle_pointer, ptr, precision), srid_copy: srid)
207
+ else
208
+ cast_geometry_ptr(FFIGeos.GEOSUnaryUnion_r(Geos.current_handle_pointer, ptr), srid_copy: srid)
209
+ end
186
210
  end
187
211
  end
188
212
 
@@ -306,7 +330,7 @@ module Geos
306
330
  bool_result(FFIGeos.GEOSCovers_r(Geos.current_handle_pointer, ptr, geom.ptr))
307
331
  end
308
332
  else
309
- def covers?(geom) #:nodoc:
333
+ def covers?(geom) # :nodoc:
310
334
  check_geometry(geom)
311
335
  !!%w{
312
336
  T*****FF*
@@ -328,7 +352,7 @@ module Geos
328
352
  bool_result(FFIGeos.GEOSCoveredBy_r(Geos.current_handle_pointer, ptr, geom.ptr))
329
353
  end
330
354
  else
331
- def covered_by?(geom) #:nodoc:
355
+ def covered_by?(geom) # :nodoc:
332
356
  check_geometry(geom)
333
357
  !!%w{
334
358
  T*F**F***
@@ -362,7 +386,7 @@ module Geos
362
386
 
363
387
  def eql_almost?(other, decimal = 6)
364
388
  check_geometry(other)
365
- bool_result(FFIGeos.GEOSEqualsExact_r(Geos.current_handle_pointer, ptr, other.ptr, 0.5 * 10 ** -decimal))
389
+ bool_result(FFIGeos.GEOSEqualsExact_r(Geos.current_handle_pointer, ptr, other.ptr, 0.5 * (10 ** -decimal)))
366
390
  end
367
391
  alias equals_almost? eql_almost?
368
392
  alias almost_equals? eql_almost?
@@ -417,7 +441,7 @@ module Geos
417
441
 
418
442
  # GEOS versions prior to 3.3.0 didn't handle exceptions and can crash on
419
443
  # bad input.
420
- if FFIGeos.respond_to?(:GEOSProject_r) && Geos::GEOS_VERSION >= '3.3.0'
444
+ if FFIGeos.respond_to?(:GEOSProject_r) && Geos::GEOS_NICE_VERSION >= '030300'
421
445
  def project(geom, normalized = false)
422
446
  raise TypeError, 'Expected Geos::Point type' unless geom.is_a?(Geos::Point)
423
447
 
@@ -695,6 +719,18 @@ module Geos
695
719
  end
696
720
  end
697
721
 
722
+ if FFIGeos.respond_to?(:GEOSMaximumInscribedCircle_r)
723
+ def maximum_inscribed_circle(precision)
724
+ cast_geometry_ptr(FFIGeos.GEOSMaximumInscribedCircle_r(Geos.current_handle_pointer, ptr, precision))
725
+ end
726
+ end
727
+
728
+ if FFIGeos.respond_to?(:GEOSLargestEmptyCircle_r)
729
+ def largest_empty_circle(precision, boundary: nil)
730
+ cast_geometry_ptr(FFIGeos.GEOSLargestEmptyCircle_r(Geos.current_handle_pointer, ptr, boundary ? boundary.ptr : nil, precision))
731
+ end
732
+ end
733
+
698
734
  if FFIGeos.respond_to?(:GEOSMinimumWidth_r)
699
735
  def minimum_width
700
736
  cast_geometry_ptr(FFIGeos.GEOSMinimumWidth_r(Geos.current_handle_pointer, ptr))
@@ -82,18 +82,18 @@ module Geos
82
82
  translate
83
83
  }.each do |m|
84
84
  class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
85
- def #{m}!(*args)
85
+ def #{m}!(*args, **kwargs)
86
86
  unless self.empty?
87
87
  self.num_geometries.times do |i|
88
- self[i].#{m}!(*args)
88
+ self[i].#{m}!(*args, **kwargs)
89
89
  end
90
90
  end
91
91
 
92
92
  self
93
93
  end
94
94
 
95
- def #{m}(*args)
96
- ret = self.dup.#{m}!(*args)
95
+ def #{m}(*args, **kwargs)
96
+ ret = self.dup.#{m}!(*args, **kwargs)
97
97
  ret.srid = pick_srid_according_to_policy(self.srid)
98
98
  ret
99
99
  end
@@ -42,7 +42,7 @@ module Geos
42
42
  end
43
43
  alias slice []
44
44
 
45
- def offset_curve(width, options = {})
45
+ def offset_curve(width, **options)
46
46
  options = Constants::BUFFER_PARAM_DEFAULTS.merge(options)
47
47
 
48
48
  cast_geometry_ptr(
@@ -81,7 +81,7 @@ module Geos
81
81
  cur_path.concat(to_a)
82
82
  end
83
83
 
84
- def snap_to_grid!(*args)
84
+ def snap_to_grid!(*args, **)
85
85
  unless empty?
86
86
  cs = coord_seq.snap_to_grid!(*args)
87
87
 
@@ -97,7 +97,7 @@ module Geos
97
97
  self
98
98
  end
99
99
 
100
- def snap_to_grid(*args)
100
+ def snap_to_grid(*args, **)
101
101
  ret = dup.snap_to_grid!(*args)
102
102
  ret.srid = pick_srid_according_to_policy(srid)
103
103
  ret
@@ -126,9 +126,9 @@ module Geos
126
126
  dseg = (fraction - total_length) / seg_length
127
127
 
128
128
  args = []
129
- args << p_1.x + ((p_2.x - p_1.x) * dseg)
130
- args << p_1.y + ((p_2.y - p_1.y) * dseg)
131
- args << p_1.z + ((p_2.z - p_1.z) * dseg) if has_z?
129
+ args << (p_1.x + ((p_2.x - p_1.x) * dseg))
130
+ args << (p_1.y + ((p_2.y - p_1.y) * dseg))
131
+ args << (p_1.z + ((p_2.z - p_1.z) * dseg)) if has_z?
132
132
 
133
133
  args << { srid: pick_srid_according_to_policy(srid) } unless srid.zero?
134
134
 
@@ -193,16 +193,16 @@ module Geos
193
193
  translate
194
194
  }.each do |m|
195
195
  class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
196
- def #{m}!(*args)
196
+ def #{m}!(*args, **kwargs)
197
197
  unless self.empty?
198
- self.coord_seq.#{m}!(*args)
198
+ self.coord_seq.#{m}!(*args, **kwargs)
199
199
  end
200
200
 
201
201
  self
202
202
  end
203
203
 
204
- def #{m}(*args)
205
- ret = self.dup.#{m}!(*args)
204
+ def #{m}(*args, **kwargs)
205
+ ret = self.dup.#{m}!(*args, **kwargs)
206
206
  ret.srid = pick_srid_according_to_policy(self.srid)
207
207
  ret
208
208
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Geos
4
4
  class MultiLineString < GeometryCollection
5
- if FFIGeos.respond_to?(:GEOSisClosed_r) && Geos::GEOS_VERSION >= '3.5.0'
5
+ if FFIGeos.respond_to?(:GEOSisClosed_r) && Geos::GEOS_NICE_VERSION >= '030500'
6
6
  # Available in GEOS 3.5.0+.
7
7
  def closed?
8
8
  bool_result(FFIGeos.GEOSisClosed_r(Geos.current_handle_pointer, ptr))
@@ -118,16 +118,16 @@ module Geos
118
118
  translate
119
119
  }.each do |m|
120
120
  class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
121
- def #{m}!(*args)
121
+ def #{m}!(*args, **kwargs)
122
122
  unless empty?
123
- coord_seq.#{m}!(*args)
123
+ coord_seq.#{m}!(*args, **kwargs)
124
124
  end
125
125
 
126
126
  self
127
127
  end
128
128
 
129
- def #{m}(*args)
130
- ret = dup.#{m}!(*args)
129
+ def #{m}(*args, **kwargs)
130
+ ret = dup.#{m}!(*args, **kwargs)
131
131
  ret.srid = pick_srid_according_to_policy(srid)
132
132
  ret
133
133
  end
@@ -125,16 +125,16 @@ module Geos
125
125
  translate
126
126
  }.each do |m|
127
127
  class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
128
- def #{m}!(*args)
129
- exterior_ring.coord_seq.#{m}!(*args)
128
+ def #{m}!(*args, **kwargs)
129
+ exterior_ring.coord_seq.#{m}!(*args, **kwargs)
130
130
  interior_rings.each do |ring|
131
131
  ring.coord_seq.#{m}!(*args)
132
132
  end
133
133
  self
134
134
  end
135
135
 
136
- def #{m}(*args)
137
- ret = dup.#{m}!(*args)
136
+ def #{m}(*args, **kwargs)
137
+ ret = dup.#{m}!(*args, **kwargs)
138
138
  ret.srid = pick_srid_according_to_policy(srid)
139
139
  ret
140
140
  end
@@ -24,7 +24,7 @@ module Geos
24
24
  @ptr.autorelease = !!options[:auto_free]
25
25
  end
26
26
 
27
- def self.release(ptr) #:nodoc:
27
+ def self.release(ptr) # :nodoc:
28
28
  FFIGeos.GEOSPreparedGeom_destroy_r(Geos.current_handle_pointer, ptr)
29
29
  end
30
30