Skip to content

Instantly share code, notes, and snippets.

@zdavatz
Created March 14, 2011 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zdavatz/869081 to your computer and use it in GitHub Desktop.
Save zdavatz/869081 to your computer and use it in GitHub Desktop.
ODBA - drbwrapper.rb
def to_obj(ref)
test = ref
if(test.is_a?(String) || (test = @unsaved[ref]))
DRbWrapper.new(ODBA.cache.fetch(test.to_i))
else
super
end
rescue RuntimeError => e
raise RangeError, e.message
end
@mhatakeyama
Copy link

Could be re-written to:

def to_obj(ref)
if(ref.is_a?(String) || (test = @unsaved[ref]))
DRbWrapper.new(ODBA.cache.fetch(test.to_i))
else
super
end
rescue RuntimeError => e
raise RangeError, e.message
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment