Class: Localwiki::Map

Inherits:
Resource
  • Object
show all
Defined in:
lib/localwiki/resource.rb

Overview

represents map object returned from server localwiki.readthedocs.org/en/latest/api.html#maps

Instance Attribute Summary

Attributes inherited from Resource

#json

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Localwiki::Resource

Instance Method Details

#latObject



54
55
56
# File 'lib/localwiki/resource.rb', line 54

def lat
  self.points['coordinates'].first[0] if self.single_point?
end

#line?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/localwiki/resource.rb', line 46

def line?
  self.lines
end

#longObject



58
59
60
# File 'lib/localwiki/resource.rb', line 58

def long
  self.points['coordinates'].first[1] if self.single_point?
end

#poly?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/localwiki/resource.rb', line 50

def poly?
  self.polys
end

#single_point?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/localwiki/resource.rb', line 42

def single_point?
  self.points && self.points['coordinates'].size == 1
end