Class: Kml::Path::Parser
- Inherits:
-
Object
- Object
- Kml::Path::Parser
- Defined in:
- lib/kml/path/parser.rb
Constant Summary collapse
- KMZ_CONTENT_TYPES =
%w[application/vnd.google-earth.kmz application/zip].freeze
- KML_NAMESPACES =
{ "kml" => "http://www.opengis.net/kml/2.2", "gx" => "http://www.google.com/kml/ext/2.2" }.freeze
- NAME_XPATHS =
[ ["//kml:Document/kml:name", KML_NAMESPACES], ["//kml:Placemark/kml:name", KML_NAMESPACES], ["//kml:name", KML_NAMESPACES], ["//Document/name", nil], ["//Placemark/name", nil] ].freeze
- MISSING_GEOMETRY =
"must contain a LineString or gx:Track"- MISSING_KML =
"must contain a KML file"
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(file:) ⇒ Parser
constructor
A new instance of Parser.
- #name ⇒ Object
- #parse ⇒ Object
- #parse! ⇒ Object
Constructor Details
#initialize(file:) ⇒ Parser
Returns a new instance of Parser.
21 22 23 |
# File 'lib/kml/path/parser.rb', line 21 def initialize(file:) @file = file end |
Instance Method Details
#content ⇒ Object
40 41 42 43 |
# File 'lib/kml/path/parser.rb', line 40 def content parse @content end |
#name ⇒ Object
36 37 38 |
# File 'lib/kml/path/parser.rb', line 36 def name parse.success? ? parse.name : extract_name end |
#parse ⇒ Object
25 26 27 |
# File 'lib/kml/path/parser.rb', line 25 def parse @parse ||= build_parse_result end |
#parse! ⇒ Object
29 30 31 32 33 34 |
# File 'lib/kml/path/parser.rb', line 29 def parse! result = parse raise ParseError, result.error if result.failure? result end |