On 22.06.2017 17:34, Une Bévue wrote:
I've to write a class opening remote session, and I wonder if it is
possible to write it such a way that ensure a closing session ?
say I've a class :
class Toto
def self.open
// do the job to open a session
end
def self.getSomething
return something
end
def self.close
// close the session
end
end
I do not think it is wise to use class methods for that. I'd rather
create an instance for that - even if it is a singleton or assigned to a
global variable.
I'd like to have Toto.close automatically called when no more method
used (it supposes a certain amount of time ?)
http://ruby-doc.org/stdlib-2.4.1/libdoc/timeout/rdoc/index.html
Cheers
robert
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)