Skip to content

Commit

Permalink
Add support for Ruby 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ledermann committed Feb 14, 2021
1 parent 201492e commit c2babfb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -6,6 +6,7 @@ rvm:
- "2.3.0"
- "2.4.0"
- "2.5.0"
- "3.0.0"
- jruby-9.0.5.0
- rbx-2
matrix:
Expand Down
15 changes: 14 additions & 1 deletion lib/geo/coord.rb
Expand Up @@ -319,9 +319,22 @@ def _extract_match(match, name)
# g = Geo::Coord.new(lat: 50.004444)
# # => #<Geo::Coord 50°0'16"N 0°0'0"W>
#
def initialize(lat = nil, lng = nil, **opts)
def initialize(*args)
@globe = Globes::Earth.instance

case args.length
when 1
opts = args[0]
lat = nil
lng = nil
when 2
opts = {}
lat = args[0]
lng = args[1]
else
raise ArgumentError, "Can't create #{self.class} by provided data"
end

case
when lat && lng
_init(lat, lng)
Expand Down

0 comments on commit c2babfb

Please sign in to comment.