class Rumination::DevUser
Constants
- CannotBeInitialized
Attributes
email[RW]
host[RW]
name[RW]
password[RW]
Public Class Methods
new(args={})
click to toggle source
Calls superclass method
# File lib/rumination/dev_user.rb, line 10 def initialize args={} super self.name ||= ENV["USER"] self.name ||= self.email[/^.*(?=@)/] if self.email.present? raise CannotBeInitialized, "Can't guess dev user name" unless self.name.present? self.password ||= ENV["DEV_PASSWORD"] raise CannotBeInitialized, "Can't guess dev user password" unless self.password.present? self.host ||= ENV["DEV_HOST"] raise CannotBeInitialized, "Can't guess dev user email" unless self.email.present? || self.host.present? self.email ||= [name, host].join("@") end
Public Instance Methods
attribute_names()
click to toggle source
# File lib/rumination/dev_user.rb, line 26 def attribute_names %w[name password host email] end
attributes()
click to toggle source
# File lib/rumination/dev_user.rb, line 22 def attributes attribute_names.map{|attribute| [attribute, send(attribute)]}.to_h end