Class: Ti::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

Returns the value of attribute copyright.



5
6
7
# File 'lib/ti/config.rb', line 5

def copyright
  @copyright
end

#descriptionObject

Returns the value of attribute description.



5
6
7
# File 'lib/ti/config.rb', line 5

def description
  @description
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/ti/config.rb', line 5

def id
  @id
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/ti/config.rb', line 5

def name
  @name
end

#publisherObject

Returns the value of attribute publisher.



5
6
7
# File 'lib/ti/config.rb', line 5

def publisher
  @publisher
end

#urlObject

Returns the value of attribute url.



5
6
7
# File 'lib/ti/config.rb', line 5

def url
  @url
end

#versionObject

Returns the value of attribute version.



5
6
7
# File 'lib/ti/config.rb', line 5

def version
  @version
end

Instance Method Details

#parse(filename) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ti/config.rb', line 7

def parse(filename)
  xml  = File.open(filename)
  doc    = Nokogiri::XML(xml)
  xml.close
  # parse into properties
  @id           = doc.xpath('ti:app/id').text
  @name         = doc.xpath('ti:app/name').text
  @version      = doc.xpath('ti:app/version').text
  @publisher    = doc.xpath('ti:app/publisher').text
  @url          = doc.xpath('ti:app/url').text
  @description  = doc.xpath('ti:app/description').text
  @copyright    = doc.xpath('ti:app/copyright').text
end