Module: PlusCodes

Defined in:
lib/plus_codes.rb,
lib/plus_codes/version.rb,
lib/plus_codes/code_area.rb,
lib/plus_codes/open_location_code.rb

Overview

Plus+Codes is a Ruby implementation of Google Open Location Code(Plus+Codes).

Author:

  • We-Ming Wu

Defined Under Namespace

Classes: CodeArea, OpenLocationCode

Constant Summary collapse

SEPARATOR =

A separator used to separate the code into two parts.

'+'.freeze
SEPARATOR_POSITION =

The max number of characters can be placed before the separator.

8
PADDING =

The character used to pad a code

'0'.freeze
CODE_ALPHABET =

The character set used to encode coordinates.

'23456789CFGHJMPQRVWX'.freeze
DECODE =

ASCII lookup table.

(CODE_ALPHABET.chars + [PADDING, SEPARATOR]).reduce([]) do |ary, c|
  ary[c.ord] = CODE_ALPHABET.index(c)
  ary[c.downcase.ord] = CODE_ALPHABET.index(c)
  ary[c.ord] ||= -1
  ary
end.freeze
VERSION =
'0.2.0'