Class: String

Inherits:
Object show all
Includes:
JactiveSupport::CoreExtensions::Enum
Defined in:
lib/jactive_support/core_ext/enum.rb,
lib/jactive_support/core_ext/locale.rb,
lib/jactive_support/core_ext/ordering.rb,
lib/jactive_support/core_ext/to_java_sqldate.rb,
lib/jactive_support/core_ext/to_java_time_zone.rb,
lib/jactive_support/core_ext/to_java_date.rb

Instance Method Summary collapse

Methods included from JactiveSupport::CoreExtensions::Enum

#flash_with_enum, included, #to_java_with_enum

Instance Method Details

#<=>(b) ⇒ Object



20
21
22
# File 'lib/jactive_support/core_ext/ordering.rb', line 20

def <=>(b)
  b.nil? ? 1 : super
end

#to_java_dateObject



22
23
24
# File 'lib/jactive_support/core_ext/to_java_date.rb', line 22

def to_java_date
  to_datetime.to_java_date
end

#to_java_sqldateObject



18
19
20
# File 'lib/jactive_support/core_ext/to_java_sqldate.rb', line 18

def to_java_sqldate
  to_datetime.to_java_sqldate
end

#to_java_time_zoneObject



4
5
6
# File 'lib/jactive_support/core_ext/to_java_time_zone.rb', line 4

def to_java_time_zone
  java::util::TimeZone.getTimeZone(self)
end

#to_localeObject

Returns the java.util.Locale that maches this string



13
14
15
16
17
18
19
20
21
# File 'lib/jactive_support/core_ext/locale.rb', line 13

def to_locale
  if self =~ /^(.+)[-_](.+)[-_](.+)$/
    java::util::Locale.new($1, $2, $3)
  elsif self =~ /^(.+)[-_](.+)$/
    java::util::Locale.new($1, $2)
  else
    java::util::Locale.new(self)
  end
end