Class: Rlyeh::DeepOnes::Auth::Basic

Inherits:
Base
  • Object
show all
Defined in:
lib/rlyeh/deep_ones/auth/basic.rb

Instance Attribute Summary

Attributes inherited from Base

#host, #nick, #pass, #real, #user

Instance Method Summary collapse

Methods inherited from Base

#authenticated?, #call, #failed, #session_id, #succeeded, #welcome

Methods included from Logger

crash, format_exception

Methods included from Rlyeh::Dispatcher

#dispatch, included, #trigger

Constructor Details

#initialize(app, nick, pass) ⇒ Basic

Returns a new instance of Basic.



5
6
7
8
# File 'lib/rlyeh/deep_ones/auth/basic.rb', line 5

def initialize(app, nick, pass)
  @basic = [nick, pass].freeze
  super app
end

Instance Method Details

#try(env) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/rlyeh/deep_ones/auth/basic.rb', line 10

def try(env)
  if @basic == [nick, pass]
    succeeded env
    welcome env
  else
    failed env
  end
end