Sha256: c94227a2b68cfe4694628e45837cf0ece7d9d727a31d49df6a3b3880fb7a0fc1

Contents?: true

Size: 432 Bytes

Versions: 2

Compression:

Stored size: 432 Bytes

Contents

class VisualCaptchaCN::Session
  attr_accessor :session, :namespace

  def initialize(session, namespace = 'VisualCaptchaCN')
    self.session = session
    self.namespace = namespace
  end

  def clear
    session[namespace] = {}
  end

  def get(key)
    clear if session[namespace].nil?

    session[namespace][key]
  end

  def set(key, value)
    clear if session[namespace].nil?

    session[namespace][key] = value
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
visual_captcha_cn-0.1.0 lib/visual_captcha_cn/session.rb
visual_captcha_cn-0.0.2 lib/visual_captcha_cn/session.rb