Class: Parser::GpxString

Inherits:
Base
  • Object
show all
Defined in:
lib/simple_trail/parser/gpx_string.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_content) ⇒ GpxString

Returns a new instance of GpxString.



6
7
8
# File 'lib/simple_trail/parser/gpx_string.rb', line 6

def initialize(file_content)
  @file_content = file_content
end

Instance Attribute Details

#parsed_fileObject (readonly)

Returns the value of attribute parsed_file.



4
5
6
# File 'lib/simple_trail/parser/gpx_string.rb', line 4

def parsed_file
  @parsed_file
end

#pointsObject (readonly)

Returns the value of attribute points.



4
5
6
# File 'lib/simple_trail/parser/gpx_string.rb', line 4

def points
  @points
end

#points_of_interestsObject (readonly)

Returns the value of attribute points_of_interests.



4
5
6
# File 'lib/simple_trail/parser/gpx_string.rb', line 4

def points_of_interests
  @points_of_interests
end

#simplified_pointsObject (readonly)

Returns the value of attribute simplified_points.



4
5
6
# File 'lib/simple_trail/parser/gpx_string.rb', line 4

def simplified_points
  @simplified_points
end

Instance Method Details

#metaObject



17
18
19
# File 'lib/simple_trail/parser/gpx_string.rb', line 17

def meta
  @meta ||= extract_data
end

#readObject



10
11
12
13
14
15
# File 'lib/simple_trail/parser/gpx_string.rb', line 10

def read
  @parsed_file = XmlHasher.parse(@file_content)[:gpx]
  fail unless @parsed_file
  extract_points
  extract_pois
end