Class: ISO3166::YMLData

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

Constant Summary collapse

@@semaphore =
Mutex.new
@@data =
nil

Class Method Summary collapse

Class Method Details

.find(code) ⇒ Object



21
22
23
24
# File 'lib/iso3166/yml_data.rb', line 21

def find(code)
  reload!
  @@data[code.to_s]
end

.reload!Object



13
14
15
16
17
18
19
# File 'lib/iso3166/yml_data.rb', line 13

def reload!
  return if @@data

  @@semaphore.synchronize do
    @@data = YAML.load_file(ISO3166::Countries.yml_data_path)
  end
end

.reset!Object



9
10
11
# File 'lib/iso3166/yml_data.rb', line 9

def reset!
  @@data = nil
end