Class: SafeEntry
- Inherits:
-
Object
- Object
- SafeEntry
- Defined in:
- lib/safeentry.rb
Overview
SafeEntry A single entry (name, ID, password) in the “safe”
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#password ⇒ Object
Returns the value of attribute password.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #equals?(other) ⇒ Boolean
-
#initialize(name, id, password) ⇒ SafeEntry
constructor
A new instance of SafeEntry.
- #to_s ⇒ Object
Constructor Details
#initialize(name, id, password) ⇒ SafeEntry
Returns a new instance of SafeEntry.
42 43 44 45 46 |
# File 'lib/safeentry.rb', line 42 def initialize(name, id, password) self.name = name self.id = id self.password = password end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
40 41 42 |
# File 'lib/safeentry.rb', line 40 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
40 41 42 |
# File 'lib/safeentry.rb', line 40 def name @name end |
#password ⇒ Object
Returns the value of attribute password.
40 41 42 |
# File 'lib/safeentry.rb', line 40 def password @password end |
Instance Method Details
#<=>(other) ⇒ Object
52 53 54 |
# File 'lib/safeentry.rb', line 52 def <=>(other) self.name.upcase <=> other.name.upcase end |
#equals?(other) ⇒ Boolean
56 57 58 59 60 61 62 |
# File 'lib/safeentry.rb', line 56 def equals? other if other == nil false else self.name == other.name && self.id == other.id && self.password == other.password end end |
#to_s ⇒ Object
48 49 50 |
# File 'lib/safeentry.rb', line 48 def to_s "#@name\t#@id\t#@password" end |