Class: Gippix::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/gippix.rb

Direct Known Subclasses

Gpx

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_name) ⇒ Base

Returns a new instance of Base.



37
38
39
40
41
# File 'lib/gippix.rb', line 37

def initialize(file_name)
  @file_name = file_name
  @doc = Nokogiri::XML( File.read file_name )
  @points = []
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



35
36
37
# File 'lib/gippix.rb', line 35

def description
  @description
end

#docObject

Returns the value of attribute doc.



35
36
37
# File 'lib/gippix.rb', line 35

def doc
  @doc
end

#file_nameObject

Returns the value of attribute file_name.



35
36
37
# File 'lib/gippix.rb', line 35

def file_name
  @file_name
end

#nameObject

Returns the value of attribute name.



35
36
37
# File 'lib/gippix.rb', line 35

def name
  @name
end

#pointsObject

Returns the value of attribute points.



35
36
37
# File 'lib/gippix.rb', line 35

def points
  @points
end

Instance Method Details

#with(xpath) {|@doc.xpath(xpath)| ... } ⇒ Object

Yields:

  • (@doc.xpath(xpath))


43
44
45
# File 'lib/gippix.rb', line 43

def with xpath, &blk
  yield @doc.xpath(xpath)
end