Class: Jcsv::Locale

Inherits:
Object
  • Object
show all
Defined in:
lib/locale.rb,
lib/locale.rb

Overview

Constant Summary collapse

CANADA =
Locale.new(locale: java.util.Locale::CANADA)
CANADA_FRENCH =
Locale.new(locale: java.util.Locale::CANADA_FRENCH)
CHINA =
Locale.new(locale: java.util.Locale::CHINA)
CHINESE =
Locale.new(locale: java.util.Locale::CHINESE)
ENGLISH =
Locale.new(locale: java.util.Locale::ENGLISH)
FRANCE =
Locale.new(locale: java.util.Locale::FRANCE)
FRENCH =
Locale.new(locale: java.util.Locale::FRENCH)
GERMAN =
Locale.new(locale: java.util.Locale::GERMAN)
GERMANY =
Locale.new(locale: java.util.Locale::GERMANY)
ITALIAN =
Locale.new(locale: java.util.Locale::ITALIAN)
ITALY =
Locale.new(locale: java.util.Locale::ITALY)
JAPAN =
Locale.new(locale: java.util.Locale::JAPAN)
JAPANESE =
Locale.new(locale: java.util.Locale::JAPANESE)
KOREA =
Locale.new(locale: java.util.Locale::KOREA)
KOREAN =
Locale.new(locale: java.util.Locale::KOREAN)
PRC =
Locale.new(locale: java.util.Locale::PRC)
ROOT =
Locale.new(locale: java.util.Locale::ROOT)
SIMPLIFIED_CHINESE =
Locale.new(locale: java.util.Locale::SIMPLIFIED_CHINESE)
TAIWAN =
Locale.new(locale: java.util.Locale::TAIWAN)
TRADITIONAL_CHINESE =
Locale.new(locale: java.util.Locale::TRADITIONAL_CHINESE)
UK =
Locale.new(locale: java.util.Locale::UK)
US =
Locale.new(locale: java.util.Locale::US)
BRAZIL =
Locale.new(language: "pt", country: "BR")

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(locale: nil, language: nil, country: nil, variant: nil) ⇒ Locale





80
81
82
83
84
85
86
87
88
89
90
# File 'lib/locale.rb', line 80

def initialize(locale: nil, language: nil, country: nil, variant: nil)
  
  args = [language, country, variant]
  
  if (locale)
    @locale = locale
  else
    @locale = java.util.Locale.new(*(args.compact))
  end
  
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args) ⇒ Object





96
97
98
# File 'lib/locale.rb', line 96

def method_missing(symbol, *args)
  @locale.send(symbol, *args)
end

Class Attribute Details

.available_locsObject

Returns the value of attribute available_locs.



31
32
33
# File 'lib/locale.rb', line 31

def available_locs
  @available_locs
end

Instance Attribute Details

#localeObject

Returns the value of attribute locale.



28
29
30
# File 'lib/locale.rb', line 28

def locale
  @locale
end

Class Method Details

.available_localesObject





40
41
42
43
44
45
46
47
48
49
50
# File 'lib/locale.rb', line 40

def self.available_locales
  
  if (@available_locs.size == 0)
    java.util.Locale.available_locales.each do |loc|
      @available_locs << Locale.new(loc)
    end
  end
  
  @available_locs
  
end

.defaultObject





56
57
58
# File 'lib/locale.rb', line 56

def self.default
  Locale.new(locale: java.util.Locale.default)
end

.default=(locale) ⇒ Object





64
65
66
# File 'lib/locale.rb', line 64

def self.default=(locale)
  java.util.Locale.set_default(locale.locale)
end

.method_missing(symbol, *args) ⇒ Object





72
73
74
# File 'lib/locale.rb', line 72

def self.method_missing(symbol, *args)
  java.util.Locale.send(symbol, *args)
end