Class: CLDR::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/cldr/resource.rb

Overview

An abstract class of Resoureces

Direct Known Subclasses

Calendar, Core, Currency, Number, Supplemental, TimeZone

Instance Method Summary collapse

Constructor Details

#initialize(locale, fallback, textdomain) ⇒ Resource

:nodoc:



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/cldr/resource.rb', line 15

def initialize(locale, fallback, textdomain) #:nodoc:
  script = ""
  [locale.to_simple, locale.to_s, locale.language, fallback.to_simple].each do |v|
    path = File.join(RESOURCE_DIR, v, "#{textdomain}.rb")
    if FileTest.file?(path)
      File.open(path){|v| script = v.read}
      break
    end
  end
  self.class.class_eval(script)
  init_data
end