module Flagmoji
Constants
- VERSION
Public Instance Methods
all()
click to toggle source
# File lib/flagmoji.rb, line 12 def all @all ||= map_data_to_country end
data_file()
click to toggle source
# File lib/flagmoji.rb, line 8 def data_file File.expand_path("../../data/flags.json", __FILE__) end
from_code(code)
click to toggle source
# File lib/flagmoji.rb, line 16 def from_code(code) all[code] || Country.null end
Also aliased as: []
Private Instance Methods
map_data_to_country()
click to toggle source
# File lib/flagmoji.rb, line 24 def map_data_to_country json = JSON.parse(File.read(data_file)) Hash[json.map { |country, data| [country, Country.from_data(data)] }] end