Skip to content

Commit 88ae22c

Browse files
committed
[Truffle More of @offset in Time.
1 parent 30ac04b commit 88ae22c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

truffle/src/main/java/org/jruby/truffle/nodes/core/TimeNodes.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,14 @@ public InternalOffsetNode(InternalOffsetNode prev) {
6666
}
6767

6868
@Specialization
69-
public RubyNilClass internalOffset(RubyTime time) {
70-
return getContext().getCoreLibrary().getNilObject();
69+
public Object internalOffset(RubyTime time) {
70+
final Object offset = time.getOffset();
71+
72+
if (offset == null) {
73+
return getContext().getCoreLibrary().getNilObject();
74+
} else {
75+
return offset;
76+
}
7177
}
7278
}
7379

@@ -83,8 +89,9 @@ public InternalSetOffsetNode(InternalSetOffsetNode prev) {
8389
}
8490

8591
@Specialization
86-
public boolean internalSetGMT(RubyTime time, Object setOffset) {
87-
throw new UnsupportedOperationException("_set_offset " + setOffset.getClass());
92+
public Object internalSetOffset(RubyTime time, Object offset) {
93+
time.setOffset(offset);
94+
return offset;
8895
}
8996
}
9097

0 commit comments

Comments
 (0)