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
-
#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.
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
#id ⇒ Object
Returns the value of attribute id.
37 38 39 |
# File 'lib/safeentry.rb', line 37 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
37 38 39 |
# File 'lib/safeentry.rb', line 37 def name @name end |
#password ⇒ Object
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_s ⇒ Object
45 46 47 |
# File 'lib/safeentry.rb', line 45 def to_s "#@name\t#@id\t#@password" end |