Class: LocationsNg::Lga
- Inherits:
-
Object
- Object
- LocationsNg::Lga
- Defined in:
- lib/locations_ng/lga.rb
Class Method Summary collapse
Class Method Details
.all ⇒ Object
3 4 5 |
# File 'lib/locations_ng/lga.rb', line 3 def self.all load_lgas end |
.lgas(state) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/locations_ng/lga.rb', line 7 def self.lgas(state) state = state.downcase.gsub(' ', '_') all_lgas = load_lgas lga_index = all_lgas.index{|l| l['alias'] == state} if lga_index.nil? {message: "No lgas found for '#{state}'", status: 404} else all_lgas[lga_index]['lgas'] end end |