Class: LookupIDS

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

Class Method Summary collapse

Class Method Details

.find_region_id(region_name) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/study_the_map/lookupids.rb', line 10

def self.find_region_id(region_name)
  
  region_element = self.index.css("regions region").detect do |region|
    region.text.strip == region_name
  end

  region_element['id']

end

.find_ski_area_id(area_name) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/study_the_map/lookupids.rb', line 20

def self.find_ski_area_id(area_name)

  ski_area_element = self.index.search("skiArea").detect do |ski_area|
    ski_area.search("name").text.strip == area_name
  end

  ski_area_element['id']
  
end

.indexObject



4
5
6
7
8
# File 'lib/study_the_map/lookupids.rb', line 4

def self.index

  doc = Nokogiri::XML(open("./lib/fixtures/index.xml"))
  
end