jactive_support 2.1.2 → 3.0.0.pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/jactive_support.gemspec +1 -1
- data/lib/jactive_support/core_ext/enum.rb +1 -1
- data/lib/jactive_support/core_ext/ordering.rb +0 -6
- data/lib/jactive_support/core_ext/to_java_time_zone.rb +13 -0
- data/lib/jactive_support/java_ext/date/calculations.rb +34 -40
- data/lib/jactive_support/java_ext/date/conversions.rb +116 -125
- data/lib/jactive_support/java_ext/date/formatters.rb +37 -0
- data/lib/jactive_support/java_ext/date/localize.rb +12 -0
- data/lib/jactive_support/java_ext/date.rb +3 -36
- data/lib/jactive_support/java_ext/sql_date/conversions.rb +26 -33
- data/lib/jactive_support/java_ext/sql_date/localize.rb +21 -0
- data/lib/jactive_support/java_ext/sql_date.rb +1 -4
- data/lib/jactive_support/java_ext/to_java_time_zone.rb +5 -0
- data/lib/jactive_support/localize.rb +70 -0
- data/lib/jactive_support/version.rb +2 -2
- data/lib/jactive_support.rb +1 -0
- data/spec/java_ext/date/localize_spec.rb +51 -0
- data/spec/java_ext/date/parse_spec.rb +55 -0
- data/spec/java_ext/date/strformat_spec.rb +39 -0
- data/spec/java_ext/date/to_formatted_s_spec.rb +58 -0
- data/spec/java_ext/sql_date/localize_spec.rb +15 -0
- data/spec/java_ext/sql_date/parse_spec.rb +15 -0
- data/spec/shared/fixtures.rb +47 -1
- metadata +42 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0297ee0a2e0b4672a75a7323a8b580cb0052b8a0
|
4
|
+
data.tar.gz: 8a5cbbe1f45df687f7895daf72156c2b8f4f8d43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6e1ca038a4b8181f5edf6a15442be621e854f2ba86ab61fa8ec316896099cb2a9ad1bf34b8a628a5d2b87877b5bb8448e85f15262a81450f0e6d08856d0f528
|
7
|
+
data.tar.gz: df7b8f760490a155f85ace4721f12ca50f5dc125aaed4da9cc01a83220a2ea49d8240b84a954281e95f2808889a0c360ad4339bd50f9b6706a552348dc113d65
|
data/jactive_support.gemspec
CHANGED
@@ -4,7 +4,7 @@ require "jactive_support/version"
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "jactive_support"
|
7
|
-
s.version =
|
7
|
+
s.version = JactiveSupport::VERSION
|
8
8
|
s.author = "Brian Olsen"
|
9
9
|
s.email = "brian@maven-group.org"
|
10
10
|
s.homepage = "http://github.com/griff/jactive_support"
|
@@ -1,43 +1,37 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
return ::Java::OrgJodaTime::Months.monthsBetween(local_date, since_date).getMonths
|
36
|
-
else
|
37
|
-
return ::Java::OrgJodaTime::Years.yearsBetween(local_date, since_date).getYears
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
1
|
+
class java::util::Date
|
2
|
+
CALCULATION_FIELDS = {
|
3
|
+
years: java::util::Calendar::YEAR,
|
4
|
+
months: java::util::Calendar::MONTH,
|
5
|
+
weeks: java::util::Calendar::WEEK_OF_YEAR,
|
6
|
+
days: java::util::Calendar::DAY_OF_MONTH,
|
7
|
+
hours: java::util::Calendar::HOUR_OF_DAY,
|
8
|
+
minutes: java::util::Calendar::MINUTE,
|
9
|
+
seconds: java::util::Calendar::SECOND,
|
10
|
+
millis: java::util::Calendar::MILLISECOND
|
11
|
+
}
|
12
|
+
|
13
|
+
def advance(options)
|
14
|
+
cal = java::util::Calendar.instance
|
15
|
+
cal.time = self
|
16
|
+
options.each do |field, value|
|
17
|
+
cal.add(CALCULATION_FIELDS[field], value)
|
18
|
+
end
|
19
|
+
cal.time
|
20
|
+
end
|
21
|
+
|
22
|
+
def age(since = Date.new)
|
23
|
+
difference(:years, since)
|
24
|
+
end
|
25
|
+
|
26
|
+
def difference(field = :years, since = Date.new)
|
27
|
+
local_date = org::joda::time::LocalDate.fromDateFields(self)
|
28
|
+
since_date = org::joda::time::LocalDate.fromDateFields(since)
|
29
|
+
if field == :days
|
30
|
+
return org::joda::time::Days.daysBetween(local_date, since_date).days
|
31
|
+
elsif field == :months
|
32
|
+
return org::joda::time::Months.monthsBetween(local_date, since_date).months
|
33
|
+
else
|
34
|
+
return org::joda::time::Years.yearsBetween(local_date, since_date).years
|
41
35
|
end
|
42
36
|
end
|
43
37
|
end
|
@@ -1,137 +1,128 @@
|
|
1
1
|
require 'active_support/core_ext/object/blank'
|
2
|
+
require 'jactive_support/java_ext/date/localize'
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
:long_ordinal => lambda { |clazz| clazz.pattern_formatter("MMMMMM #{time.day.ordinalize}, yyyy HH:mm") },
|
22
|
-
:rfc822 => "EEE, dd MMM yyyy HH:mm:ss Z",
|
23
|
-
:httpdate => lambda { |clazz| clazz.pattern_formatter("EEE, dd MMM yyyy HH:mm:ss z", "GMT", "EN") }
|
24
|
-
}
|
4
|
+
class java::util::Date
|
5
|
+
DATE_FORMATS = {
|
6
|
+
:db => "yyyy-MM-dd HH:mm:ss.SSS",
|
7
|
+
:i18n => lambda { |clazz, locale| clazz.i18n_formatter(locale: locale) },
|
8
|
+
:number => "yyyyMMddHHmmssSSS",
|
9
|
+
:time => "HH:mm:ss",
|
10
|
+
:full => lambda { |clazz, locale| clazz.date_time_instance(:full, :full, locale) },
|
11
|
+
:long => lambda { |clazz, locale| clazz.date_time_instance(:long, :long, locale) },
|
12
|
+
:medium => lambda { |clazz, locale| clazz.date_time_instance(:medium, :medium, locale) },
|
13
|
+
:short => lambda { |clazz, locale| clazz.date_time_instance(:short, :short, locale) },
|
14
|
+
:default => lambda { |clazz, locale| clazz.date_time_instance(:default, :default, locale) },
|
15
|
+
:rfc822 => "EEE, dd MMM yyyy HH:mm:ss Z",
|
16
|
+
:httpdate => lambda { |clazz, locale|
|
17
|
+
fmt = clazz.pattern_formatter("EEE, dd MMM yyyy HH:mm:ss z", locale || 'EN')
|
18
|
+
fmt.time_zone = 'GMT'.to_java_time_zone
|
19
|
+
fmt
|
20
|
+
}
|
21
|
+
}
|
25
22
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
23
|
+
def self.formatter(format = :i18n, options = {})
|
24
|
+
formatter = self::DATE_FORMATS[format] || formatter(:default, options)
|
25
|
+
if formatter.respond_to?(:call)
|
26
|
+
if formatter.arity == 2
|
27
|
+
formatter = formatter.call(self, options[:locale])
|
28
|
+
else
|
29
|
+
formatter = formatter.call(self)
|
30
|
+
end
|
31
|
+
elsif formatter.is_a?(String)
|
32
|
+
formatter = self.pattern_formatter(formatter, options[:locale])
|
33
|
+
end
|
34
|
+
|
35
|
+
if options[:time_zone] && formatter.respond_to?(:time_zone)
|
36
|
+
formatter.time_zone = options[:time_zone].to_java_time_zone
|
37
|
+
end
|
33
38
|
|
34
|
-
|
35
|
-
|
36
|
-
return format(:default, locale) unless formatter = self::DATE_FORMATS[format]
|
37
|
-
locale = locale.to_locale
|
38
|
-
formatter = formatter.respond_to?(:call) ? (formatter.arity==2 ? formatter.call(self, locale) : formatter.call(self)) : self.pattern_formatter(formatter)
|
39
|
-
formatter.to_pattern
|
40
|
-
end
|
39
|
+
formatter
|
40
|
+
end
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
formatter.respond_to?(:call) ? (formatter.arity==2 ? formatter.call(self, locale) : formatter.call(self)) : self.pattern_formatter(formatter)
|
46
|
-
end
|
42
|
+
def self.format(format = :i18n, options = {})
|
43
|
+
formatter(format, options).to_pattern
|
44
|
+
end
|
47
45
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
46
|
+
# Converts to a formatted string. See DATE_FORMATS for builtin formats.
|
47
|
+
#
|
48
|
+
# This method is aliased to <tt>to_s</tt>.
|
49
|
+
#
|
50
|
+
# time = java::util::Date.new # => Thu Jan 18 06:10:17 CST 2007
|
51
|
+
#
|
52
|
+
# time.to_formatted_s(:time) # => "06:10:17"
|
53
|
+
# time.to_s(:time) # => "06:10:17"
|
54
|
+
#
|
55
|
+
# time.to_formatted_s(:db) # => "2007-01-18 06:10:17.100"
|
56
|
+
# time.to_formatted_s(:number) # => "20070118061017100"
|
57
|
+
# time.to_formatted_s(:short) # => "18 Jan 06:10"
|
58
|
+
# time.to_formatted_s(:long) # => "January 18, 2007 06:10"
|
59
|
+
# time.to_formatted_s(:rfc822) # => "Thu, 18 Jan 2007 06:10:17 -0600"
|
60
|
+
#
|
61
|
+
# == Adding your own time formats to +to_formatted_s+
|
62
|
+
# You can add your own formats to the Time::DATE_FORMATS hash.
|
63
|
+
# Use the format name as the hash key and either a strftime string
|
64
|
+
# or Proc instance that takes a time argument as the value.
|
65
|
+
#
|
66
|
+
# # config/initializers/time_formats.rb
|
67
|
+
# Time::DATE_FORMATS[:month_and_year] = "%B %Y"
|
68
|
+
# Time::DATE_FORMATS[:short_ordinal] = lambda { |time| time.strftime("%B #{time.day.ordinalize}") }
|
69
|
+
def to_formatted_s(format = :i18n, options = {})
|
70
|
+
return to_default_s unless self.class::DATE_FORMATS[format]
|
71
|
+
self.class.formatter(format, options).format(self)
|
72
|
+
end
|
73
|
+
alias_method :to_default_s, :to_s
|
74
|
+
alias_method :to_s, :to_formatted_s
|
55
75
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
# time.to_formatted_s(:long) # => "January 18, 2007 06:10"
|
69
|
-
# time.to_formatted_s(:long_ordinal) # => "January 18th, 2007 06:10"
|
70
|
-
# time.to_formatted_s(:rfc822) # => "Thu, 18 Jan 2007 06:10:17 -0600"
|
71
|
-
#
|
72
|
-
# == Adding your own time formats to +to_formatted_s+
|
73
|
-
# You can add your own formats to the Time::DATE_FORMATS hash.
|
74
|
-
# Use the format name as the hash key and either a strftime string
|
75
|
-
# or Proc instance that takes a time argument as the value.
|
76
|
-
#
|
77
|
-
# # config/initializers/time_formats.rb
|
78
|
-
# Time::DATE_FORMATS[:month_and_year] = "%B %Y"
|
79
|
-
# Time::DATE_FORMATS[:short_ordinal] = lambda { |time| time.strftime("%B #{time.day.ordinalize}") }
|
80
|
-
def to_formatted_s(format=:i18n, locale=nil)
|
81
|
-
return to_default_s unless formatter = self.class::DATE_FORMATS[format]
|
82
|
-
locale = locale.to_locale
|
83
|
-
formatter = formatter.respond_to?(:call) ? (formatter.arity==2 ? formatter.call(self.class, locale) : formatter.call(self.class)) : self.class.pattern_formatter(formatter)
|
84
|
-
(formatter.respond_to?(:format) ? formatter.format(self) : formatter).to_s
|
85
|
-
end
|
86
|
-
|
87
|
-
def format(format=:i18n, locale=nil)
|
88
|
-
self.class.format(format, locale)
|
89
|
-
end
|
90
|
-
|
91
|
-
def formatter(format=:i18n, locale=nil)
|
92
|
-
self.class.formatter(format, locale)
|
93
|
-
end
|
76
|
+
# Converts a java.util.Date object to a string using the given format pattern.
|
77
|
+
# The pattern syntax is from java.text.SimpleDateFormat
|
78
|
+
#
|
79
|
+
# my_time = java.util.Date.new # => Mon Nov 12 22:59:51 -0500 2007
|
80
|
+
# my_time.strformat('yyyy MMMMM') # => "2007 November"
|
81
|
+
def strformat(pattern, options = {})
|
82
|
+
formatter = self.class.pattern_formatter(pattern, options[:locale])
|
83
|
+
if options[:time_zone] && formatter.respond_to?(:time_zone)
|
84
|
+
formatter.time_zone = options[:time_zone].to_java_time_zone
|
85
|
+
end
|
86
|
+
formatter.format(self)
|
87
|
+
end
|
94
88
|
|
95
|
-
|
96
|
-
|
97
|
-
|
89
|
+
# Converts a java.util.Date object to a ruby Date, dropping hour, minute, and second precision.
|
90
|
+
#
|
91
|
+
# my_time = java.util.Date.new # => Mon Nov 12 22:59:51 -0500 2007
|
92
|
+
# my_time.to_date # => Mon, 12 Nov 2007
|
93
|
+
def to_date
|
94
|
+
to_time.to_date
|
95
|
+
end
|
98
96
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
97
|
+
# Converts a java.util.Date instance to a Time.
|
98
|
+
#
|
99
|
+
# ==== Examples
|
100
|
+
# date = java.util.Date.new # => Mon Nov 12 22:59:51 -0500 2007
|
101
|
+
# date.to_time # => Mon Nov 12 22:59:51 -0500 2007
|
102
|
+
def to_time
|
103
|
+
::Time.at(self.getTime/1000)
|
104
|
+
end
|
106
105
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
106
|
+
# Converts a java.util.Date instance to a Ruby DateTime instance, preserving UTC offset.
|
107
|
+
#
|
108
|
+
# my_time = Time.now # => Mon Nov 12 23:04:21 -0500 2007
|
109
|
+
# my_time.to_datetime # => Mon, 12 Nov 2007 23:04:21 -0500
|
110
|
+
#
|
111
|
+
# your_time = Time.parse("1/13/2009 1:13:03 P.M.") # => Tue Jan 13 13:13:03 -0500 2009
|
112
|
+
# your_time.to_datetime # => Tue, 13 Jan 2009 13:13:03 -0500
|
113
|
+
def to_datetime
|
114
|
+
to_time.to_datetime
|
115
|
+
end
|
116
|
+
|
117
|
+
def to_java_sqldate
|
118
|
+
java::sql::Date.new(time)
|
119
|
+
end
|
120
|
+
|
121
|
+
def httpdate
|
122
|
+
to_formatted_s(:httpdate)
|
123
|
+
end
|
115
124
|
|
116
|
-
|
117
|
-
|
118
|
-
# my_time = Time.now # => Mon Nov 12 23:04:21 -0500 2007
|
119
|
-
# my_time.to_datetime # => Mon, 12 Nov 2007 23:04:21 -0500
|
120
|
-
#
|
121
|
-
# your_time = Time.parse("1/13/2009 1:13:03 P.M.") # => Tue Jan 13 13:13:03 -0500 2009
|
122
|
-
# your_time.to_datetime # => Tue, 13 Jan 2009 13:13:03 -0500
|
123
|
-
def to_datetime
|
124
|
-
to_time.to_datetime
|
125
|
-
end
|
126
|
-
|
127
|
-
def to_java_sqldate
|
128
|
-
java.sql.Date.new(getTime)
|
129
|
-
end
|
130
|
-
|
131
|
-
def httpdate
|
132
|
-
to_formatted_s(:httpdate)
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
125
|
+
def acts_like_time?
|
126
|
+
true
|
136
127
|
end
|
137
|
-
end
|
128
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'jactive_support/core_ext/locale'
|
2
|
+
|
3
|
+
class java::util::Date
|
4
|
+
FULL_STYLE = java::text::DateFormat::FULL
|
5
|
+
LONG_STYLE = java::text::DateFormat::LONG
|
6
|
+
MEDIUM_STYLE = java::text::DateFormat::MEDIUM
|
7
|
+
SHORT_STYLE = java::text::DateFormat::SHORT
|
8
|
+
DEFAULT_STYLE = java::text::DateFormat::DEFAULT
|
9
|
+
|
10
|
+
STYLE = {
|
11
|
+
:full => FULL_STYLE,
|
12
|
+
:long => LONG_STYLE,
|
13
|
+
:medium => MEDIUM_STYLE,
|
14
|
+
:short => SHORT_STYLE,
|
15
|
+
:default => DEFAULT_STYLE
|
16
|
+
}
|
17
|
+
|
18
|
+
def self.default_formatter(locale)
|
19
|
+
date_time_instance(:default, :default, locale)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.date_time_instance(date_style = :default, time_style = :default, locale = nil)
|
23
|
+
java::text::DateFormat.getDateTimeInstance(STYLE[date_style], STYLE[time_style], locale.to_locale)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.time_instance(time_style = :default, locale = nil)
|
27
|
+
java::text::DateFormat.getTimeInstance(STYLE[time_style], locale.to_locale)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.date_instance(date_style = :default, locale = nil)
|
31
|
+
java::text::DateFormat.getDateInstance(STYLE[date_style], locale.to_locale)
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.pattern_formatter(pattern, locale=nil)
|
35
|
+
java::text::SimpleDateFormat.new(pattern, locale.to_locale)
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'jactive_support/localize'
|
2
|
+
require 'jactive_support/java_ext/date/formatters'
|
3
|
+
require 'jactive_support/core_ext/to_java_time_zone'
|
4
|
+
require 'i18n'
|
5
|
+
|
6
|
+
class java::util::Date
|
7
|
+
include JactiveSupport::Localize
|
8
|
+
|
9
|
+
def self.i18n_scope
|
10
|
+
:java_date
|
11
|
+
end
|
12
|
+
end
|
@@ -1,37 +1,4 @@
|
|
1
|
-
require 'jactive_support/java_ext/date/
|
1
|
+
require 'jactive_support/java_ext/date/formatters'
|
2
|
+
require 'jactive_support/java_ext/date/localize'
|
2
3
|
require 'jactive_support/java_ext/date/conversions'
|
3
|
-
|
4
|
-
class java::util::Date
|
5
|
-
include JactiveSupport::JavaExtensions::Date::Calculations
|
6
|
-
include JactiveSupport::JavaExtensions::Date::Conversions
|
7
|
-
|
8
|
-
FULL_STYLE = java::text::DateFormat::FULL
|
9
|
-
LONG_STYLE = java::text::DateFormat::LONG
|
10
|
-
MEDIUM_STYLE = java::text::DateFormat::MEDIUM
|
11
|
-
SHORT_STYLE = java::text::DateFormat::SHORT
|
12
|
-
DEFAULT_STYLE = java::text::DateFormat::DEFAULT
|
13
|
-
|
14
|
-
STYLE = {
|
15
|
-
:full => FULL_STYLE,
|
16
|
-
:long => LONG_STYLE,
|
17
|
-
:medium => MEDIUM_STYLE,
|
18
|
-
:short => SHORT_STYLE,
|
19
|
-
:default => DEFAULT_STYLE
|
20
|
-
}
|
21
|
-
|
22
|
-
def acts_like_time?
|
23
|
-
true
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.date_time_instance(date_style=:default, time_style=:default, locale=nil)
|
27
|
-
java::text::DateFormat.getDateTimeInstance(STYLE[date_style], STYLE[time_style], locale.to_locale)
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.time_instance(time_style=:default, locale=nil)
|
31
|
-
java::text::DateFormat.getTimeInstance(STYLE[time_style], locale.to_locale)
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.date_instance(date_style=:default, locale=nil)
|
35
|
-
java::text::DateFormat.getDateInstance(STYLE[date_style], locale.to_locale)
|
36
|
-
end
|
37
|
-
end
|
4
|
+
require 'jactive_support/java_ext/date/calculations'
|
@@ -1,35 +1,28 @@
|
|
1
|
-
require '
|
1
|
+
require 'jactive_support/java_ext/date/conversions'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
def acts_like_time?
|
30
|
-
false
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
3
|
+
class java::sql::Date
|
4
|
+
DATE_FORMATS = {
|
5
|
+
:db => "yyyy-MM-dd",
|
6
|
+
:i18n => lambda { |clazz, locale| clazz.i18n_formatter(locale) },
|
7
|
+
:number => "yyyyMMdd",
|
8
|
+
:full => lambda { |clazz, locale| clazz.date_instance(:full, locale) },
|
9
|
+
:long => lambda { |clazz, locale| clazz.date_instance(:long, locale) },
|
10
|
+
:medium => lambda { |clazz, locale| clazz.date_instance(:medium, locale) },
|
11
|
+
:short => lambda { |clazz, locale| clazz.date_instance(:short, locale) },
|
12
|
+
:default => lambda { |clazz, locale| clazz.date_instance(:default, locale) },
|
13
|
+
:rfc822 => "EEE, dd MMM yyyy HH:mm:ss Z",
|
14
|
+
:httpdate => lambda { |clazz, locale|
|
15
|
+
fmt = clazz.pattern_formatter("EEE, dd MMM yyyy HH:mm:ss z", locale || 'EN')
|
16
|
+
fmt.time_zone = 'GMT'.to_java_time_zone
|
17
|
+
fmt
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
def to_java_sqldate
|
22
|
+
self
|
23
|
+
end
|
24
|
+
|
25
|
+
def acts_like_time?
|
26
|
+
false
|
34
27
|
end
|
35
|
-
end
|
28
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'jactive_support/java_ext/date/localize'
|
2
|
+
|
3
|
+
class java::sql::Date
|
4
|
+
def self.i18n_scope
|
5
|
+
:sql_date
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.default_formatter(locale)
|
9
|
+
date_instance(:default, locale)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.parse(str, options = {})
|
13
|
+
date = super
|
14
|
+
self.new(date.time)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.parse_i18n(str, options = {})
|
18
|
+
date = super
|
19
|
+
self.new(date.time)
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
|
3
|
+
module JactiveSupport
|
4
|
+
# Makes a class support localize and class parse method
|
5
|
+
# It expects class 3 methods be implemented on the class.
|
6
|
+
# i18n_scope - The scope to use for translations
|
7
|
+
# pattern_formatter(format, locale) - returns a formatter based on a pattern
|
8
|
+
# default_formatter(locale) - returns a default formatter when the format is blank
|
9
|
+
module Localize
|
10
|
+
extend ActiveSupport::Concern
|
11
|
+
|
12
|
+
included do
|
13
|
+
class << self
|
14
|
+
alias :parse_original :parse
|
15
|
+
alias :parse :parse_i18n
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
module ClassMethods
|
20
|
+
def i18n_formatter(options = {})
|
21
|
+
format = options[:format] || :default
|
22
|
+
locale = options.fetch(:locale, ::I18n.locale)
|
23
|
+
if Symbol === format
|
24
|
+
key = format
|
25
|
+
options = options.merge(raise: true, object: self)
|
26
|
+
format = ::I18n.t("#{self.i18n_scope}.formats.#{key}", options)
|
27
|
+
end
|
28
|
+
if format.blank?
|
29
|
+
formatter = default_formatter(locale)
|
30
|
+
else
|
31
|
+
formatter = pattern_formatter(format, locale)
|
32
|
+
end
|
33
|
+
|
34
|
+
if options[:time_zone] && formatter.respond_to?(:time_zone)
|
35
|
+
formatter.time_zone = options[:time_zone].to_java_time_zone
|
36
|
+
end
|
37
|
+
|
38
|
+
formatter
|
39
|
+
end
|
40
|
+
|
41
|
+
def parse_i18n(str, options = {})
|
42
|
+
unless options[:format]
|
43
|
+
defaults = [
|
44
|
+
:"#{self.i18n_scope}.formats.default",
|
45
|
+
options.delete(:default)]
|
46
|
+
defaults.compact!
|
47
|
+
defaults.flatten!
|
48
|
+
options[:default] = defaults unless defaults.empty?
|
49
|
+
options[:format] = :input
|
50
|
+
end
|
51
|
+
formatter = i18n_formatter(options)
|
52
|
+
formatter.parse(str)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def localize(options = {})
|
57
|
+
unless options[:format]
|
58
|
+
defaults = [
|
59
|
+
:"#{self.class.i18n_scope}.formats.default",
|
60
|
+
options.delete(:default)]
|
61
|
+
defaults.compact!
|
62
|
+
defaults.flatten!
|
63
|
+
options[:default] = defaults unless defaults.empty?
|
64
|
+
options[:format] = :output
|
65
|
+
end
|
66
|
+
formatter = self.class.i18n_formatter(options)
|
67
|
+
formatter.format(self)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
module
|
2
|
-
VERSION = "
|
1
|
+
module JactiveSupport
|
2
|
+
VERSION = "3.0.0.pre1"
|
3
3
|
end
|
data/lib/jactive_support.rb
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
require File.expand_path('../../../shared/fixtures', __FILE__)
|
2
|
+
require 'jactive_support/java_ext/date/localize'
|
3
|
+
|
4
|
+
setup_date_translations
|
5
|
+
describe "java::util::Date#localize" do
|
6
|
+
it "localizes date with format" do
|
7
|
+
date = java::util::Date.new(1192140000000)
|
8
|
+
date.localize(format: 'yyyy').should == '2007'
|
9
|
+
end
|
10
|
+
|
11
|
+
it "localizes date with symbol format" do
|
12
|
+
date = java::util::Date.new(1192140000000)
|
13
|
+
date.localize(format: :short).should == '12. Oct'
|
14
|
+
end
|
15
|
+
|
16
|
+
it "localizes date with default date time format" do
|
17
|
+
date = java::sql::Date.new(1192140000000)
|
18
|
+
date.localize(format: '').should == 'Oct 12, 2007 12:00:00 AM'
|
19
|
+
end
|
20
|
+
|
21
|
+
it "fails with missing symbol format" do
|
22
|
+
date = java::util::Date.new(1192140000000)
|
23
|
+
expect { date.localize(format: :miss) }.to raise_error(I18n::MissingTranslationData)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "localizes date with default" do
|
27
|
+
date = java::util::Date.new(1192140000000)
|
28
|
+
date.localize(default: 'yyyy', locale: :da).should == '2007'
|
29
|
+
end
|
30
|
+
|
31
|
+
it "localizes date" do
|
32
|
+
date = java::util::Date.new(1192140000000)
|
33
|
+
date.localize.should == '00:00:00.000 12/10/2007'
|
34
|
+
end
|
35
|
+
|
36
|
+
it "localizes date ignores default when localized" do
|
37
|
+
date = java::util::Date.new(1192140000000)
|
38
|
+
date.localize(default: 'yyyy').should == '00:00:00.000 12/10/2007'
|
39
|
+
end
|
40
|
+
|
41
|
+
it "localizes with time zone" do
|
42
|
+
date = java::util::Date.new(1192140000000)
|
43
|
+
date.localize(time_zone: 'GMT').should == '22:00:00.000 11/10/2007'
|
44
|
+
end
|
45
|
+
|
46
|
+
it "localizes using output format first" do
|
47
|
+
date = java::util::Date.new(1192140000000)
|
48
|
+
date.localize(format: :default, locale: :sv).should == '00:00:00.000 12-10-07'
|
49
|
+
date.localize(locale: :sv).should == '00:00:00.000 12-10-2007'
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require File.expand_path('../../../shared/fixtures', __FILE__)
|
2
|
+
require 'jactive_support/java_ext/date/localize'
|
3
|
+
|
4
|
+
setup_date_translations
|
5
|
+
describe "java::util::Date.parse" do
|
6
|
+
it "parses date with format" do
|
7
|
+
date = java::util::Date.parse('2007', format: 'yyyy')
|
8
|
+
date.localize.should == '00:00:00.000 01/01/2007'
|
9
|
+
end
|
10
|
+
|
11
|
+
it "parses date with symbol format" do
|
12
|
+
date = java::util::Date.parse('12. Oct', format: :short)
|
13
|
+
date.localize.should == '00:00:00.000 12/10/1970'
|
14
|
+
end
|
15
|
+
|
16
|
+
it "fails with missing symbol format" do
|
17
|
+
expect { java::util::Date.parse('12. Oct', format: :miss) }.to raise_error(I18n::MissingTranslationData)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "parses date with default" do
|
21
|
+
date = java::util::Date.parse('2007', default: 'yyyy', locale: :da)
|
22
|
+
date.localize.should == '00:00:00.000 01/01/2007'
|
23
|
+
end
|
24
|
+
|
25
|
+
it "parses date" do
|
26
|
+
date = java::util::Date.parse('00:00:00.000 12/10/2007')
|
27
|
+
date.localize.should == '00:00:00.000 12/10/2007'
|
28
|
+
end
|
29
|
+
|
30
|
+
it "parses date with suffix" do
|
31
|
+
date = java::util::Date.parse('00:00:00.000 12/10/2007muh')
|
32
|
+
date.localize.should == '00:00:00.000 12/10/2007'
|
33
|
+
end
|
34
|
+
|
35
|
+
it "parses date ignores default when localized" do
|
36
|
+
date = java::util::Date.parse('00:00:00.000 12/10/2007', default: 'yyyy')
|
37
|
+
date.localize.should == '00:00:00.000 12/10/2007'
|
38
|
+
end
|
39
|
+
|
40
|
+
it "parses with time zone" do
|
41
|
+
date = java::util::Date.parse('00:00:00.000 12/10/2007', time_zone: 'GMT')
|
42
|
+
date.localize.should == '02:00:00.000 12/10/2007'
|
43
|
+
end
|
44
|
+
|
45
|
+
it "parses using input format first" do
|
46
|
+
date = java::util::Date.parse('00:00:00.000 12.10.07', format: :default, locale: :fr)
|
47
|
+
date.localize.should == '00:00:00.000 12/10/0007'
|
48
|
+
date = java::util::Date.parse('00:00:00.000 12.10.07', locale: :fr)
|
49
|
+
date.localize.should == '00:00:00.000 12/10/2007'
|
50
|
+
end
|
51
|
+
|
52
|
+
it "fails with parse exception on wrong format" do
|
53
|
+
expect { java::util::Date.parse('12. Oct') }.to raise_error(java::text::ParseException)
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'jactive_support/java_ext/date/conversions'
|
2
|
+
|
3
|
+
describe "java::util::Date#strformat" do
|
4
|
+
it "formats year" do
|
5
|
+
date = java::util::Date.new(1192140000000)
|
6
|
+
date.strformat('yyyy').should == '2007'
|
7
|
+
end
|
8
|
+
|
9
|
+
it "formats month" do
|
10
|
+
date = java::util::Date.new(1192140000000)
|
11
|
+
date.strformat('MM').should == '10'
|
12
|
+
end
|
13
|
+
|
14
|
+
it "formats abbreviated month" do
|
15
|
+
date = java::util::Date.new(1192140000000)
|
16
|
+
date.strformat('MMM', locale: 'en').should == 'Oct'
|
17
|
+
end
|
18
|
+
|
19
|
+
it "formats danish abbreviated month" do
|
20
|
+
date = java::util::Date.new(1192140000000)
|
21
|
+
date.strformat('MMM', locale: 'da_DK'.to_locale).should == 'okt'
|
22
|
+
end
|
23
|
+
|
24
|
+
it "formats fulle month" do
|
25
|
+
date = java::util::Date.new(1192140000000)
|
26
|
+
date.strformat('MMMM', locale: 'en').should == 'October'
|
27
|
+
end
|
28
|
+
|
29
|
+
it "formats danish full month" do
|
30
|
+
date = java::util::Date.new(1192140000000)
|
31
|
+
date.strformat('MMMM', locale: 'da_DK'.to_locale).should == 'oktober'
|
32
|
+
end
|
33
|
+
|
34
|
+
it "formats rfc822 date" do
|
35
|
+
date = java::util::Date.new(1192140000000)
|
36
|
+
date.strformat('EEE, dd MMM yyyy HH:mm:ss Z', locale: 'en', timezone: 'CET')
|
37
|
+
.should == 'Fri, 12 Oct 2007 00:00:00 +0200'
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require File.expand_path('../../../shared/fixtures', __FILE__)
|
2
|
+
require 'jactive_support/java_ext/date/conversions'
|
3
|
+
|
4
|
+
describe "java::util::Date#to_formatted_s" do
|
5
|
+
it "formats using locale format" do
|
6
|
+
setup_date_translations
|
7
|
+
date = java::util::Date.new(1192140000000)
|
8
|
+
date.to_formatted_s(:i18n).should == '00:00:00.000 12/10/2007'
|
9
|
+
end
|
10
|
+
|
11
|
+
it "formats using locale format using locale" do
|
12
|
+
setup_date_translations
|
13
|
+
date = java::util::Date.new(1192140000000)
|
14
|
+
date.to_formatted_s(:i18n, locale: :de).should == '00:00:00.000 12.10.2007'
|
15
|
+
end
|
16
|
+
|
17
|
+
it "formats using locale format using locale and time zone" do
|
18
|
+
setup_date_translations
|
19
|
+
date = java::util::Date.new(1192140000000)
|
20
|
+
date.to_formatted_s(:i18n, locale: :de, time_zone: 'GMT').should == '22:00:00.000 11.10.2007'
|
21
|
+
end
|
22
|
+
|
23
|
+
it "formats using default format" do
|
24
|
+
setup_date_translations
|
25
|
+
date = java::util::Date.new(1192140000000)
|
26
|
+
date.to_formatted_s(:default).should == 'Oct 12, 2007 12:00:00 AM'
|
27
|
+
end
|
28
|
+
|
29
|
+
it "formats using default format using locale" do
|
30
|
+
setup_date_translations
|
31
|
+
date = java::util::Date.new(1192140000000)
|
32
|
+
date.to_formatted_s(:default, locale: :de).should == '12.10.2007 00:00:00'
|
33
|
+
end
|
34
|
+
|
35
|
+
it "formats using default format using locale and time zone" do
|
36
|
+
setup_date_translations
|
37
|
+
date = java::util::Date.new(1192140000000)
|
38
|
+
date.to_formatted_s(:default, locale: :de, time_zone: 'GMT').should == '11.10.2007 22:00:00'
|
39
|
+
end
|
40
|
+
|
41
|
+
it "formats unknown format using default" do
|
42
|
+
setup_date_translations
|
43
|
+
date = java::util::Date.new(1192140000000)
|
44
|
+
date.to_formatted_s(:muh).should == date.to_default_s
|
45
|
+
end
|
46
|
+
|
47
|
+
it "formats db with string" do
|
48
|
+
setup_date_translations
|
49
|
+
date = java::util::Date.new(1192140000000)
|
50
|
+
date.to_formatted_s(:db).should == '2007-10-12 00:00:00.000'
|
51
|
+
end
|
52
|
+
|
53
|
+
it "formats httpdate" do
|
54
|
+
setup_date_translations
|
55
|
+
date = java::util::Date.new(1192140000000)
|
56
|
+
date.to_formatted_s(:httpdate).should == 'Thu, 11 Oct 2007 22:00:00 GMT'
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.expand_path('../../../shared/fixtures', __FILE__)
|
2
|
+
require 'jactive_support/java_ext/sql_date/localize'
|
3
|
+
|
4
|
+
setup_date_translations
|
5
|
+
describe "java::sql::Date#localize" do
|
6
|
+
it "localizes sql date format" do
|
7
|
+
date = java::sql::Date.new(1192140000000)
|
8
|
+
date.localize.should == '12/10/2007'
|
9
|
+
end
|
10
|
+
|
11
|
+
it "localizes sql date with default date format" do
|
12
|
+
date = java::sql::Date.new(1192140000000)
|
13
|
+
date.localize(format: '').should == 'Oct 12, 2007'
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.expand_path('../../../shared/fixtures', __FILE__)
|
2
|
+
require 'jactive_support/java_ext/sql_date/localize'
|
3
|
+
|
4
|
+
setup_date_translations
|
5
|
+
describe "java::sql::Date.parse" do
|
6
|
+
it "parses sql date with format" do
|
7
|
+
date = java::sql::Date.parse('2007', format: 'yyyy')
|
8
|
+
date.localize.should == '01/01/2007'
|
9
|
+
end
|
10
|
+
|
11
|
+
it "localizes sql date with default date format" do
|
12
|
+
date = java::sql::Date.parse('Oct 12, 2007', format: '')
|
13
|
+
date.localize.should == '12/10/2007'
|
14
|
+
end
|
15
|
+
end
|
data/spec/shared/fixtures.rb
CHANGED
@@ -1,7 +1,53 @@
|
|
1
|
+
require 'i18n'
|
2
|
+
|
1
3
|
def enumerator_class
|
2
4
|
[].each.class
|
3
5
|
end
|
4
6
|
|
5
7
|
def ruby_bug(*args)
|
6
8
|
yield
|
7
|
-
end
|
9
|
+
end
|
10
|
+
|
11
|
+
I18n.locale = :en
|
12
|
+
java::util::Locale.default = java::util::Locale.new('en')
|
13
|
+
def setup_date_translations
|
14
|
+
I18n.backend.store_translations :en, {
|
15
|
+
:java_date => {
|
16
|
+
:formats => {
|
17
|
+
:default => 'HH:mm:ss.SSS dd/MM/yyyy',
|
18
|
+
:short => 'dd. MMM',
|
19
|
+
:long => 'dd. MMMM yyyy',
|
20
|
+
},
|
21
|
+
},
|
22
|
+
:sql_date => {
|
23
|
+
:formats => {
|
24
|
+
:default => 'dd/MM/yyyy'
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
I18n.backend.store_translations :de, {
|
29
|
+
:java_date => {
|
30
|
+
:formats => {
|
31
|
+
:default => 'HH:mm:ss.SSS dd.MM.yyyy',
|
32
|
+
:short => 'dd. MMM',
|
33
|
+
:long => 'dd. MMMM yyyy',
|
34
|
+
},
|
35
|
+
}
|
36
|
+
}
|
37
|
+
I18n.backend.store_translations :fr, {
|
38
|
+
:java_date => {
|
39
|
+
:formats => {
|
40
|
+
:default => 'HH:mm:ss.SSS dd.MM.yyyy',
|
41
|
+
:input => 'HH:mm:ss.SSS dd.MM.yy',
|
42
|
+
},
|
43
|
+
}
|
44
|
+
}
|
45
|
+
I18n.backend.store_translations :sv, {
|
46
|
+
:java_date => {
|
47
|
+
:formats => {
|
48
|
+
:default => 'HH:mm:ss.SSS dd-MM-yy',
|
49
|
+
:output => 'HH:mm:ss.SSS dd-MM-yyyy',
|
50
|
+
},
|
51
|
+
}
|
52
|
+
}
|
53
|
+
end
|
metadata
CHANGED
@@ -1,85 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jactive_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0.pre1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Olsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.2.1
|
14
20
|
requirement: !ruby/object:Gem::Requirement
|
15
21
|
requirements:
|
16
22
|
- - '>='
|
17
23
|
- !ruby/object:Gem::Version
|
18
24
|
version: 3.2.1
|
19
|
-
name: activesupport
|
20
25
|
prerelease: false
|
21
26
|
type: :runtime
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
22
29
|
version_requirements: !ruby/object:Gem::Requirement
|
23
30
|
requirements:
|
24
31
|
- - '>='
|
25
32
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
-
- !ruby/object:Gem::Dependency
|
33
|
+
version: 1.0.0
|
28
34
|
requirement: !ruby/object:Gem::Requirement
|
29
35
|
requirements:
|
30
36
|
- - '>='
|
31
37
|
- !ruby/object:Gem::Version
|
32
38
|
version: 1.0.0
|
33
|
-
name: bundler
|
34
39
|
prerelease: false
|
35
40
|
type: :development
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
36
43
|
version_requirements: !ruby/object:Gem::Requirement
|
37
44
|
requirements:
|
38
|
-
- -
|
45
|
+
- - ~>
|
39
46
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
41
|
-
- !ruby/object:Gem::Dependency
|
47
|
+
version: 2.6.0
|
42
48
|
requirement: !ruby/object:Gem::Requirement
|
43
49
|
requirements:
|
44
50
|
- - ~>
|
45
51
|
- !ruby/object:Gem::Version
|
46
52
|
version: 2.6.0
|
47
|
-
name: rspec
|
48
53
|
prerelease: false
|
49
54
|
type: :development
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
50
57
|
version_requirements: !ruby/object:Gem::Requirement
|
51
58
|
requirements:
|
52
|
-
- -
|
59
|
+
- - '>='
|
53
60
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
55
|
-
- !ruby/object:Gem::Dependency
|
61
|
+
version: 0.9.2
|
56
62
|
requirement: !ruby/object:Gem::Requirement
|
57
63
|
requirements:
|
58
64
|
- - '>='
|
59
65
|
- !ruby/object:Gem::Version
|
60
66
|
version: 0.9.2
|
61
|
-
name: rake
|
62
67
|
prerelease: false
|
63
68
|
type: :development
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: jruby-openssl
|
64
71
|
version_requirements: !ruby/object:Gem::Requirement
|
65
72
|
requirements:
|
66
73
|
- - '>='
|
67
74
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0
|
69
|
-
- !ruby/object:Gem::Dependency
|
75
|
+
version: '0'
|
70
76
|
requirement: !ruby/object:Gem::Requirement
|
71
77
|
requirements:
|
72
78
|
- - '>='
|
73
79
|
- !ruby/object:Gem::Version
|
74
80
|
version: '0'
|
75
|
-
name: jruby-openssl
|
76
81
|
prerelease: false
|
77
82
|
type: :development
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - '>='
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
83
|
description: Extensions to add some activesupport flavor to java classes
|
84
84
|
email: brian@maven-group.org
|
85
85
|
executables: []
|
@@ -108,11 +108,14 @@ files:
|
|
108
108
|
- lib/jactive_support/core_ext/to_java_list.rb
|
109
109
|
- lib/jactive_support/core_ext/to_java_map.rb
|
110
110
|
- lib/jactive_support/core_ext/to_java_sqldate.rb
|
111
|
+
- lib/jactive_support/core_ext/to_java_time_zone.rb
|
111
112
|
- lib/jactive_support/java_blamable.rb
|
112
113
|
- lib/jactive_support/java_ext.rb
|
113
114
|
- lib/jactive_support/java_ext/date.rb
|
114
115
|
- lib/jactive_support/java_ext/date/calculations.rb
|
115
116
|
- lib/jactive_support/java_ext/date/conversions.rb
|
117
|
+
- lib/jactive_support/java_ext/date/formatters.rb
|
118
|
+
- lib/jactive_support/java_ext/date/localize.rb
|
116
119
|
- lib/jactive_support/java_ext/enum.rb
|
117
120
|
- lib/jactive_support/java_ext/iterable.rb
|
118
121
|
- lib/jactive_support/java_ext/iterator.rb
|
@@ -125,11 +128,14 @@ files:
|
|
125
128
|
- lib/jactive_support/java_ext/number.rb
|
126
129
|
- lib/jactive_support/java_ext/sql_date.rb
|
127
130
|
- lib/jactive_support/java_ext/sql_date/conversions.rb
|
131
|
+
- lib/jactive_support/java_ext/sql_date/localize.rb
|
132
|
+
- lib/jactive_support/java_ext/to_java_time_zone.rb
|
128
133
|
- lib/jactive_support/json.rb
|
129
134
|
- lib/jactive_support/json/encoders/collection.rb
|
130
135
|
- lib/jactive_support/json/encoders/locale.rb
|
131
136
|
- lib/jactive_support/json/encoders/map.rb
|
132
137
|
- lib/jactive_support/json/encoding.rb
|
138
|
+
- lib/jactive_support/localize.rb
|
133
139
|
- lib/jactive_support/rescuable.rb
|
134
140
|
- lib/jactive_support/version.rb
|
135
141
|
- spec/constantize_spec.rb
|
@@ -137,6 +143,10 @@ files:
|
|
137
143
|
- spec/core_ext/module_spec.rb
|
138
144
|
- spec/core_ext/ordering_spec.rb
|
139
145
|
- spec/enum_spec.rb
|
146
|
+
- spec/java_ext/date/localize_spec.rb
|
147
|
+
- spec/java_ext/date/parse_spec.rb
|
148
|
+
- spec/java_ext/date/strformat_spec.rb
|
149
|
+
- spec/java_ext/date/to_formatted_s_spec.rb
|
140
150
|
- spec/java_ext/iterable/clear_spec.rb
|
141
151
|
- spec/java_ext/iterable/delete_if_spec.rb
|
142
152
|
- spec/java_ext/iterable/empty_spec.rb
|
@@ -216,6 +226,8 @@ files:
|
|
216
226
|
- spec/java_ext/map/value_spec.rb
|
217
227
|
- spec/java_ext/map/values_at_spec.rb
|
218
228
|
- spec/java_ext/map/values_spec.rb
|
229
|
+
- spec/java_ext/sql_date/localize_spec.rb
|
230
|
+
- spec/java_ext/sql_date/parse_spec.rb
|
219
231
|
- spec/locale_spec.rb
|
220
232
|
- spec/shared/fixtures.rb
|
221
233
|
- spec/shared/version.rb
|
@@ -234,9 +246,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
234
246
|
version: '0'
|
235
247
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
236
248
|
requirements:
|
237
|
-
- - '
|
249
|
+
- - '>'
|
238
250
|
- !ruby/object:Gem::Version
|
239
|
-
version:
|
251
|
+
version: 1.3.1
|
240
252
|
requirements: []
|
241
253
|
rubyforge_project:
|
242
254
|
rubygems_version: 2.1.9
|
@@ -249,6 +261,10 @@ test_files:
|
|
249
261
|
- spec/core_ext/module_spec.rb
|
250
262
|
- spec/core_ext/ordering_spec.rb
|
251
263
|
- spec/enum_spec.rb
|
264
|
+
- spec/java_ext/date/localize_spec.rb
|
265
|
+
- spec/java_ext/date/parse_spec.rb
|
266
|
+
- spec/java_ext/date/strformat_spec.rb
|
267
|
+
- spec/java_ext/date/to_formatted_s_spec.rb
|
252
268
|
- spec/java_ext/iterable/clear_spec.rb
|
253
269
|
- spec/java_ext/iterable/delete_if_spec.rb
|
254
270
|
- spec/java_ext/iterable/empty_spec.rb
|
@@ -328,6 +344,8 @@ test_files:
|
|
328
344
|
- spec/java_ext/map/value_spec.rb
|
329
345
|
- spec/java_ext/map/values_at_spec.rb
|
330
346
|
- spec/java_ext/map/values_spec.rb
|
347
|
+
- spec/java_ext/sql_date/localize_spec.rb
|
348
|
+
- spec/java_ext/sql_date/parse_spec.rb
|
331
349
|
- spec/locale_spec.rb
|
332
350
|
- spec/shared/fixtures.rb
|
333
351
|
- spec/shared/version.rb
|