Module: IsdCode

Defined in:
lib/isd_code.rb

Constant Summary collapse

@@config =
YAML::load_file(flag_file)

Class Method Summary collapse

Class Method Details

.code(name = nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/isd_code.rb', line 10

def self.code(name = nil)
	if name.nil?
		puts "Enter country name or ISD code"
		name = gets.chomp
	end
	value = @@config[name.to_s.downcase]
	if value.nil?
		if @@config.key(name).nil?
			return "Enable to find results"
		else
			return @@config.key(name)
		end
	else
		return value	
	end	
end

.custom_yaml_file_path(file) ⇒ Object



6
7
8
# File 'lib/isd_code.rb', line 6

def self.custom_yaml_file_path(file)
	@@config = YAML::load_file(file)
end