Class: Dust::Session

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Naming
Includes:
ActiveModel::Conversion, ActiveModel::Validations
Defined in:
app/models/dust/session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = nil, user = nil) ⇒ Session

Returns a new instance of Session.



12
13
14
15
16
17
18
# File 'app/models/dust/session.rb', line 12

def initialize(attributes=nil, user=nil)
  attributes ||= {}
  @user = user
  attributes.each do |name, value|
    send("#{name}=", value)
  end
end

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



7
8
9
# File 'app/models/dust/session.rb', line 7

def password
  @password
end

#remember_meObject

Returns the value of attribute remember_me.



7
8
9
# File 'app/models/dust/session.rb', line 7

def remember_me
  @remember_me
end

#userObject

Returns the value of attribute user.



7
8
9
# File 'app/models/dust/session.rb', line 7

def user
  @user
end

#usernameObject

Returns the value of attribute username.



7
8
9
# File 'app/models/dust/session.rb', line 7

def username
  @username
end

Instance Method Details

#found_user?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'app/models/dust/session.rb', line 20

def found_user?
  errors[:base] << "User not found" unless @user
end

#persisted?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'app/models/dust/session.rb', line 24

def persisted?
  false
end