Class: Atlasq::Command::Country
- Defined in:
- lib/atlasq/command/country.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Atlasq::Command::Base
Instance Method Details
#content ⇒ String
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/atlasq/command/country.rb', line 9 def content if search_terms.empty? country_codes = Data.all_countries Format.countries(country_codes, title: "All Countries") else search_terms.map do |term| if (country_code = Data.country(term)) Format.country(country_code) elsif (country_codes = PartialMatch.countries(term)).any? Format.countries(country_codes, title: "Countries (Partial Match)") else Atlasq.failed! "Unknown country: #{term}" end end.join("\n\n") end end |