Module: Factbook
- Defined in:
- lib/factbook-codes.rb,
lib/factbook-codes.rb,
lib/factbook-codes/codes.rb,
lib/factbook-codes/version.rb
Overview
note: make codes available
Defined Under Namespace
Modules: Module Classes: Codes, Test
Constant Summary collapse
- Logging =
logging machinery shortcut; use LogUtils for now
LogUtils::Logging
Class Method Summary collapse
-
.codes ⇒ Object
note: load on demand only builtin codes, comparisons, etc.
-
.region_to_slug(text) ⇒ Object
check: move region_to_slug into a utility module / helper for (re)use - how, why? why not??.
Class Method Details
.codes ⇒ Object
note: load on demand only builtin codes, comparisons, etc.
for now
25 26 27 |
# File 'lib/factbook-codes.rb', line 25 def self.codes @@codes ||= Codes.read_csv( "#{Factbook::Module::Codes.root}/data/codes.csv" ); end |
.region_to_slug(text) ⇒ Object
check: move region_to_slug into a utility module / helper
for (re)use - how, why? why not??
11 12 13 14 15 16 17 18 |
# File 'lib/factbook-codes/codes.rb', line 11 def self.region_to_slug( text ) ## change and => n ## change & => n ## change all spaces to => - ## e.g. East & Southeast Asia => east-n-southeast-asia ## Central America and Caribbean => central-america-n-caribbean text.downcase.gsub('and', 'n').gsub( '&', 'n' ).gsub( ' ', '-' ) end |