Sha256: 28a550c8bcd61c8282e8f172d905ba54f34e3db0cd50d74eb8da19d68fa4e4ba

Contents?: true

Size: 994 Bytes

Versions: 2

Compression:

Stored size: 994 Bytes

Contents

module OLD
  module SITE
    CN = :cn
    EN = :www
    ES = :es
    FR = :fr
    JP = :ja
    KO = :ko
    PL = :pl
    RU = :ru
    TH = :th

    def self.all
      self.constants.map do |name|
        self.const_get(name)
      end
    end

    def self.create(obj)
      map = {
        "cn" => CN,
        "en" => EN,
        "es" => ES,
        "fr" => FR,
        "jp" => JP,
        "ko" => KO,
        "pl" => PL,
        "ru" => RU,
        "th" => TH
      }
      map[obj]
    end
  end

  def get_endpoint(site)
    case site
    when SITE::CN
      "www.scp-wiki-cn.org"
    when SITE::ES
      "lafundacionscp.wikidot.com"
    when SITE::FR
      "fondationscp.wikidot.com"
    when SITE::PL, SITE::TH
      "scp-#{site.to_s}.wikidot.com"
    when SITE::RU
      "scpfoundation.ru"
    else
      "#{site.to_s}.scp-wiki.net"
    end
  end

  def get_locale(site)
    case site
    when SITE::CN
      "zh_CN"
    when SITE::EN
      ""
    else
      site.to_s
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
old-0.1.1 lib/locale.rb
old-0.1.0 lib/locale.rb