Skip to content

Commit

Permalink
Generalize this by calling get in base class vs override all types
Browse files Browse the repository at this point in the history
  • Loading branch information
enebo committed Aug 18, 2023
1 parent 1a4d083 commit 1fa1e5f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,6 @@ public Object get(Object object) {
}
}

/**
* Retrieve the variable's value from the given object.
*
* @param object the object from which to retrieve this variable
* @return the variable's value or %undefined
*/
public Object getOrUndefined(Object object) {
try {
Object value = getter.invoke(object);
return value == null ? UndefinedValue.UNDEFINED : (IRubyObject) value;
} catch (Throwable t) {
Helpers.throwException(t);
return null;
}
}
/**
* Retrieve the variable's value from the given object.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ public Object get(Object object) {
* Retrieve object or IR %undefined
*/
public Object getOrUndefined(Object object) {
Object value = getVariable((RubyBasicObject) object, index);

Object value = get(object);
return value == null ? UndefinedValue.UNDEFINED : value;
}

Expand Down

0 comments on commit 1fa1e5f

Please sign in to comment.