class LoginPresenter

Copyright © 2020-2021 Andy Maleh

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Attributes

password[RW]
status[RW]
user_name[RW]

Public Class Methods

new() click to toggle source
# File lib/glimmer-dsl-opal/samples/elaborate/login.rb, line 28
def initialize
  @user_name = ""
  @password = ""
  @status = "Logged Out"
end

Public Instance Methods

logged_in?() click to toggle source
# File lib/glimmer-dsl-opal/samples/elaborate/login.rb, line 42
def logged_in?
  self.status == "Logged In"
end
logged_out?() click to toggle source
# File lib/glimmer-dsl-opal/samples/elaborate/login.rb, line 46
def logged_out?
  !self.logged_in?
end
login!() click to toggle source
# File lib/glimmer-dsl-opal/samples/elaborate/login.rb, line 50
def login!
  return unless valid?
  self.status = "Logged In"
end
logout!() click to toggle source
# File lib/glimmer-dsl-opal/samples/elaborate/login.rb, line 55
def logout!
  self.user_name = ""
  self.password = ""
  self.status = "Logged Out"
end
status=(status) click to toggle source
# File lib/glimmer-dsl-opal/samples/elaborate/login.rb, line 34
def status=(status)
  @status = status
end
valid?() click to toggle source
# File lib/glimmer-dsl-opal/samples/elaborate/login.rb, line 38
def valid?
  !@user_name.to_s.strip.empty? && !@password.to_s.strip.empty?
end