Sha256: 79fe685d2b778f3f9ba012e40eb1c53673424a2ea7f6a29ce13ac97caadfb79e
Contents?: true
Size: 566 Bytes
Versions: 8
Compression:
Stored size: 566 Bytes
Contents
module RubyHackernews module MechanizeContext @@contexts = {} def self.agent=(key) @@default = key end def agent @@default ||= :default @@contexts[@@default] = Mechanize.new unless @@contexts[@@default] return @@contexts[@@default] end def [](key) return @@contexts[key] end def require_authentication raise NotAuthenticatedError unless authenticated? end def authenticated?(key = :default) return @@contexts[key] && @@contexts[key].cookie_jar.jar.any? end end end
Version data entries
8 entries across 8 versions & 1 rubygems