Class: Neo4j::Spatial::OSMWays

Inherits:
Object
  • Object
show all
Defined in:
lib/neo4j/spatial/osm.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nodes) ⇒ OSMWays

Returns a new instance of OSMWays.



53
54
55
# File 'lib/neo4j/spatial/osm.rb', line 53

def initialize(nodes)
  @nodes = nodes
end

Instance Attribute Details

#nodesObject (readonly)

Returns the value of attribute nodes.



52
53
54
# File 'lib/neo4j/spatial/osm.rb', line 52

def nodes
  @nodes
end

Instance Method Details

#[](index) ⇒ Object



62
63
64
65
66
# File 'lib/neo4j/spatial/osm.rb', line 62

def [](index)
  index.is_a?(Range) ?
    @nodes.to_a[index].map{|n| OSMWay.new(n)} :
    OSMWay.new(@nodes.to_a[index])
end

#eachObject



56
57
58
# File 'lib/neo4j/spatial/osm.rb', line 56

def each
  @nodes.each{|n| yield OSMWay.new(n)}
end

#firstObject



59
60
61
# File 'lib/neo4j/spatial/osm.rb', line 59

def first
  OSMWay.new @nodes.first
end