Class: Sesc::Cities

Inherits:
Object
  • Object
show all
Defined in:
lib/sesc/cities.rb,
lib/sesc/cities/sp.rb

Defined Under Namespace

Classes: Sp

Constant Summary collapse

CITIES_FOLDER =
'/lib/sesc/cities/'

Class Method Summary collapse

Class Method Details

.cities_pathObject



17
18
19
# File 'lib/sesc/cities.rb', line 17

def self.cities_path
  Gem::Specification.find_by_name('sesc').gem_dir + CITIES_FOLDER
end

.include?(city) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/sesc/cities.rb', line 7

def self.include?(city)
  valids.include?(city.downcase)
end

.validsObject



11
12
13
14
15
# File 'lib/sesc/cities.rb', line 11

def self.valids
  Dir[cities_path + '*'].map do |b|
    b.gsub(cities_path, '').gsub('.rb', '').downcase
  end
end