Sha256: 18e0c0361b3ae75c3119f4e889acc24b152838401d4de1f6b3e581a7659bd248

Contents?: true

Size: 821 Bytes

Versions: 7

Compression:

Stored size: 821 Bytes

Contents

# encoding: utf-8

module SportDb
  module Import

##
#  note: check that shape/structure/fields/attributes match
#            the ActiveRecord model !!!!

class Country

  ## note: is read-only/immutable for now - why? why not?
  ##          add cities (array/list) - why? why not?
  attr_reader   :key, :name, :code, :tags
  attr_accessor :alt_names

  def initialize( key: nil, name:, code:, tags: [] )
    ## note: auto-generate key "on-the-fly" if missing for now - why? why not?
    ## note: quick hack - auto-generate key, that is, remove all non-ascii chars and downcase
    @key = key || name.downcase.gsub( /[^a-z]/, '' )
    @name, @code = name, code
    @alt_names      = []
    @tags           = tags
  end

end  # class Country


end   # module Import
end   # module SportDb

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sportdb-formats-1.1.3 lib/sportdb/formats/structs/country.rb
sportdb-formats-1.1.2 lib/sportdb/formats/structs/country.rb
sportdb-formats-1.1.1 lib/sportdb/formats/structs/country.rb
sportdb-formats-1.1.0 lib/sportdb/formats/structs/country.rb
sportdb-formats-1.0.6 lib/sportdb/formats/structs/country.rb
sportdb-formats-1.0.5 lib/sportdb/formats/structs/country.rb
sportdb-formats-1.0.4 lib/sportdb/formats/structs/country.rb