Class: SafeEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/safeentry.rb

Overview

SafeEntry A single entry (name, ID, password) in the “safe”

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, id, password) ⇒ SafeEntry

Returns a new instance of SafeEntry.



39
40
41
42
43
# File 'lib/safeentry.rb', line 39

def initialize(name, id, password)
  @name = name
  @id = id
  @password = password
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



37
38
39
# File 'lib/safeentry.rb', line 37

def id
  @id
end

#nameObject

Returns the value of attribute name.



37
38
39
# File 'lib/safeentry.rb', line 37

def name
  @name
end

#passwordObject

Returns the value of attribute password.



37
38
39
# File 'lib/safeentry.rb', line 37

def password
  @password
end

Instance Method Details

#<=>(other) ⇒ Object



49
50
51
# File 'lib/safeentry.rb', line 49

def <=>(other)
  self.name.upcase <=> other.name.upcase
end

#to_sObject



45
46
47
# File 'lib/safeentry.rb', line 45

def to_s
  "#@name\t#@id\t#@password"
end