Class: SetecAstronomy::KeePass::Entry
- Inherits:
-
Object
- Object
- SetecAstronomy::KeePass::Entry
- Defined in:
- lib/setec_astronomy/kee_pass/entry.rb
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(payload_io) ⇒ Entry
constructor
A new instance of Entry.
- #length ⇒ Object
- #notes ⇒ Object
- #password ⇒ Object
- #title ⇒ Object
- #username ⇒ Object
Constructor Details
#initialize(payload_io) ⇒ Entry
Returns a new instance of Entry.
44 45 46 47 48 49 50 51 52 |
# File 'lib/setec_astronomy/kee_pass/entry.rb', line 44 def initialize(payload_io) fields = [] begin field = EntryField.new(payload_io) fields << field end while not field.terminator? @fields = fields end |
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
42 43 44 |
# File 'lib/setec_astronomy/kee_pass/entry.rb', line 42 def fields @fields end |
Class Method Details
Instance Method Details
#length ⇒ Object
54 55 56 |
# File 'lib/setec_astronomy/kee_pass/entry.rb', line 54 def length @fields.map(&:length).reduce(&:+) end |
#notes ⇒ Object
58 59 60 |
# File 'lib/setec_astronomy/kee_pass/entry.rb', line 58 def notes @fields.detect { |field| field.name == 'notes' }.data end |
#password ⇒ Object
62 63 64 |
# File 'lib/setec_astronomy/kee_pass/entry.rb', line 62 def password @fields.detect { |field| field.name == 'password' }.data.chomp("\000") end |
#title ⇒ Object
66 67 68 |
# File 'lib/setec_astronomy/kee_pass/entry.rb', line 66 def title @fields.detect { |field| field.name == 'title' }.data.chomp("\000") end |
#username ⇒ Object
70 71 72 |
# File 'lib/setec_astronomy/kee_pass/entry.rb', line 70 def username @fields.detect { |field| field.name == 'username' }.data end |