org.jruby
Class RubyTime
java.lang.Object
org.jruby.RubyObject
org.jruby.RubyTime
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, InstanceVariables, InternalVariables, IRubyObject, CoreObjectType
public class RubyTime
- extends RubyObject
The Time class.
- Author:
- chadfowler, jpetersen
- See Also:
- Serialized Form
Field Summary |
static java.lang.String |
UTC
|
Fields inherited from class org.jruby.RubyObject |
ALL_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, metaClassName, NEVER, NIL_F, OBJECT_ALLOCATOR, TAINTED_F, UNDEF, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, VARIABLE_TABLE_DEFAULT_CAPACITY, VARIABLE_TABLE_EMPTY_TABLE, VARIABLE_TABLE_LOAD_FACTOR, VARIABLE_TABLE_MAXIMUM_CAPACITY, variableTable, variableTableSize, variableTableThreshold |
Method Summary |
RubyString |
asctime()
|
static IRubyObject |
at(ThreadContext context,
IRubyObject recv,
IRubyObject[] args)
|
static RubyClass |
createTimeClass(Ruby runtime)
|
RubyString |
dump(IRubyObject[] args,
Block unusedBlock)
|
IRubyObject |
eql_p(IRubyObject other)
rb_obj_equal
Just like "==" and "equal?", "eql?" will use identity equality for Object. |
DateTime |
getDateTime()
|
RubyTime |
getgm()
|
java.util.Date |
getJavaDate()
|
RubyTime |
getlocal()
|
static DateTimeZone |
getLocalTimeZone(Ruby runtime)
|
protected long |
getTimeInMillis()
|
long |
getUSec()
|
RubyInteger |
gmt_offset()
|
RubyBoolean |
gmt()
|
RubyTime |
gmtime()
|
RubyFixnum |
hash()
rb_obj_id
Will return the hash code of this object. |
RubyInteger |
hour()
|
IRubyObject |
initialize_copy(IRubyObject original)
rb_obj_init_copy
Initializes this object as a copy of the original, that is the
parameter to this object. |
IRubyObject |
initialize(Block block)
|
RubyBoolean |
isdst()
|
static RubyTime |
load(IRubyObject recv,
IRubyObject from,
Block block)
|
RubyTime |
localtime()
|
RubyInteger |
mday()
|
RubyObject |
mdump(IRubyObject[] args)
|
long |
microseconds()
|
RubyInteger |
min()
|
RubyInteger |
month()
|
static RubyTime |
new_local(IRubyObject recv,
IRubyObject[] args)
|
static RubyTime |
new_utc(IRubyObject recv,
IRubyObject[] args)
|
static IRubyObject |
newInstance(ThreadContext context,
IRubyObject recv,
IRubyObject[] args,
Block block)
|
static RubyTime |
newTime(Ruby runtime,
DateTime dt,
long usec)
|
static RubyTime |
newTime(Ruby runtime,
long milliseconds)
|
IRubyObject |
op_cmp(IRubyObject other)
|
IRubyObject |
op_eqq(ThreadContext context,
IRubyObject other)
rb_equal
The Ruby "===" method is used by default in case/when
statements. |
IRubyObject |
op_ge(ThreadContext context,
IRubyObject other)
|
IRubyObject |
op_gt(ThreadContext context,
IRubyObject other)
|
IRubyObject |
op_le(ThreadContext context,
IRubyObject other)
|
IRubyObject |
op_lt(ThreadContext context,
IRubyObject other)
|
IRubyObject |
op_minus(IRubyObject other)
|
IRubyObject |
op_plus(IRubyObject other)
|
protected static RubyTime |
s_mload(IRubyObject recv,
RubyTime time,
IRubyObject from)
|
static IRubyObject |
s_new(IRubyObject recv,
IRubyObject[] args,
Block block)
|
RubyInteger |
sec()
|
void |
setDateTime(DateTime dt)
|
void |
setMicroseconds(long mic)
|
void |
setUSec(long usec)
|
RubyString |
strftime(IRubyObject format)
|
RubyTime |
succ()
|
RubyArray |
to_a()
rb_any_to_a
call-seq:
obj.to_a -> anArray
Returns an array representation of obj. |
RubyFloat |
to_f()
|
RubyInteger |
to_i()
|
IRubyObject |
to_s()
rb_any_to_s
call-seq:
obj.to_s => string
Returns a string representing obj. |
void |
updateCal(DateTime dt)
|
RubyInteger |
usec()
|
RubyInteger |
wday()
|
RubyInteger |
yday()
|
RubyInteger |
year()
|
RubyString |
zone()
|
Methods inherited from class org.jruby.RubyObject |
addFinalizer, anyToString, asJavaString, asString, attachToObjectSpace, callInit, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkFrozen, checkStringType, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToString, convertToType, copySpecialInstanceVariables, createObjectClass, dataGetStruct, dataWrapStruct, display, dup, ensureInstanceVariablesSettable, eql, eqlInternal, equal_p, equalInternal, equals, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, freeze, frozen_p, getFlag, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariableList, getInternalVariables, getJavaClass, getMetaClass, getNativeTypeIndex, getRuntime, getSingletonClass, getSingletonClassClone, getType, getVariableCount, getVariableList, getVariableMap, getVariableNameList, hashCode, hasInstanceVariable, hasInternalVariable, hasVariables, id_deprecated, id, infectBy, initialize, inspect, instance_eval, instance_exec, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, isClass, isFalse, isFrozen, isImmediate, isModule, isNil, isRubyVariable, isTaint, isTrue, kind_of_p, makeMetaClass, method, methods, nil_p, op_equal, op_match, private_methods, protected_methods, public_methods, puts, rbClone, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respondsTo, send, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setTaint, singleton_methods, specificEval, syncVariables, taint, tainted_p, testFrozen, toString, type_deprecated, type, untaint, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableGetMap, variableTableGetMap, variableTableGetSize, variableTableGetTable, variableTableReadLocked, variableTableRehash, variableTableRemove, variableTableStore, variableTableSync |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
UTC
public static final java.lang.String UTC
- See Also:
- Constant Field Values
RubyTime
public RubyTime(Ruby runtime,
RubyClass rubyClass)
RubyTime
public RubyTime(Ruby runtime,
RubyClass rubyClass,
DateTime dt)
getLocalTimeZone
public static DateTimeZone getLocalTimeZone(Ruby runtime)
createTimeClass
public static RubyClass createTimeClass(Ruby runtime)
setUSec
public void setUSec(long usec)
getUSec
public long getUSec()
updateCal
public void updateCal(DateTime dt)
getTimeInMillis
protected long getTimeInMillis()
newTime
public static RubyTime newTime(Ruby runtime,
long milliseconds)
newTime
public static RubyTime newTime(Ruby runtime,
DateTime dt,
long usec)
initialize_copy
public IRubyObject initialize_copy(IRubyObject original)
- Description copied from class:
RubyObject
- rb_obj_init_copy
Initializes this object as a copy of the original, that is the
parameter to this object. Will make sure that the argument
actually has the same real class as this object. It shouldn't
be possible to initialize an object with something totally
different.
- Overrides:
initialize_copy
in class RubyObject
succ
public RubyTime succ()
gmtime
public RubyTime gmtime()
localtime
public RubyTime localtime()
gmt
public RubyBoolean gmt()
getgm
public RubyTime getgm()
getlocal
public RubyTime getlocal()
strftime
public RubyString strftime(IRubyObject format)
op_ge
public IRubyObject op_ge(ThreadContext context,
IRubyObject other)
op_gt
public IRubyObject op_gt(ThreadContext context,
IRubyObject other)
op_le
public IRubyObject op_le(ThreadContext context,
IRubyObject other)
op_lt
public IRubyObject op_lt(ThreadContext context,
IRubyObject other)
op_plus
public IRubyObject op_plus(IRubyObject other)
op_minus
public IRubyObject op_minus(IRubyObject other)
op_eqq
public IRubyObject op_eqq(ThreadContext context,
IRubyObject other)
- Description copied from class:
RubyObject
- rb_equal
The Ruby "===" method is used by default in case/when
statements. The Object implementation first checks Java identity
equality and then calls the "==" method too.
- Specified by:
op_eqq
in interface IRubyObject
- Overrides:
op_eqq
in class RubyObject
op_cmp
public IRubyObject op_cmp(IRubyObject other)
eql_p
public IRubyObject eql_p(IRubyObject other)
- Description copied from class:
RubyObject
- rb_obj_equal
Just like "==" and "equal?", "eql?" will use identity equality for Object.
- Overrides:
eql_p
in class RubyObject
asctime
public RubyString asctime()
to_s
public IRubyObject to_s()
- Description copied from class:
RubyObject
- rb_any_to_s
call-seq:
obj.to_s => string
Returns a string representing obj. The default
to_s
prints the object's class and an encoding of the
object id. As a special case, the top-level object that is the
initial execution context of Ruby programs returns ``main.''
- Overrides:
to_s
in class RubyObject
to_a
public RubyArray to_a()
- Description copied from class:
RubyObject
- rb_any_to_a
call-seq:
obj.to_a -> anArray
Returns an array representation of obj. For objects of class
Object
and others that don't explicitly override the
method, the return value is an array containing self
.
However, this latter behavior will soon be obsolete.
self.to_a #=> -:1: warning: default `to_a' will be obsolete
"hello".to_a #=> ["hello"]
Time.new.to_a #=> [39, 54, 8, 9, 4, 2003, 3, 99, true, "CDT"]
The default to_a method is deprecated.
- Overrides:
to_a
in class RubyObject
to_f
public RubyFloat to_f()
to_i
public RubyInteger to_i()
usec
public RubyInteger usec()
setMicroseconds
public void setMicroseconds(long mic)
microseconds
public long microseconds()
sec
public RubyInteger sec()
min
public RubyInteger min()
hour
public RubyInteger hour()
mday
public RubyInteger mday()
month
public RubyInteger month()
year
public RubyInteger year()
wday
public RubyInteger wday()
yday
public RubyInteger yday()
gmt_offset
public RubyInteger gmt_offset()
isdst
public RubyBoolean isdst()
zone
public RubyString zone()
setDateTime
public void setDateTime(DateTime dt)
getDateTime
public DateTime getDateTime()
getJavaDate
public java.util.Date getJavaDate()
hash
public RubyFixnum hash()
- Description copied from class:
RubyObject
- rb_obj_id
Will return the hash code of this object. In comparison to MRI,
this method will use the Java identity hash code instead of
using rb_obj_id, since the usage of id in JRuby will incur the
cost of some. ObjectSpace maintainence.
- Overrides:
hash
in class RubyObject
dump
public RubyString dump(IRubyObject[] args,
Block unusedBlock)
mdump
public RubyObject mdump(IRubyObject[] args)
initialize
public IRubyObject initialize(Block block)
s_new
public static IRubyObject s_new(IRubyObject recv,
IRubyObject[] args,
Block block)
newInstance
public static IRubyObject newInstance(ThreadContext context,
IRubyObject recv,
IRubyObject[] args,
Block block)
at
public static IRubyObject at(ThreadContext context,
IRubyObject recv,
IRubyObject[] args)
new_local
public static RubyTime new_local(IRubyObject recv,
IRubyObject[] args)
new_utc
public static RubyTime new_utc(IRubyObject recv,
IRubyObject[] args)
load
public static RubyTime load(IRubyObject recv,
IRubyObject from,
Block block)
s_mload
protected static RubyTime s_mload(IRubyObject recv,
RubyTime time,
IRubyObject from)
Copyright © 2002-2007 JRuby Team. All Rights Reserved.