Class: Keepassx::Entry
- Inherits:
-
Object
- Object
- Keepassx::Entry
- Defined in:
- lib/keepassx/entry.rb
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
Class Method Summary collapse
Instance Method Summary collapse
- #group_id ⇒ Object
-
#initialize(payload_io) ⇒ Entry
constructor
A new instance of Entry.
- #inspect ⇒ Object
- #length ⇒ Object
- #notes ⇒ Object
- #password ⇒ Object
- #title ⇒ Object
- #username ⇒ Object
Constructor Details
#initialize(payload_io) ⇒ Entry
Returns a new instance of Entry.
43 44 45 46 47 48 49 50 51 |
# File 'lib/keepassx/entry.rb', line 43 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.
41 42 43 |
# File 'lib/keepassx/entry.rb', line 41 def fields @fields end |
Class Method Details
Instance Method Details
#group_id ⇒ Object
73 74 75 |
# File 'lib/keepassx/entry.rb', line 73 def group_id @fields.detect { |field| field.name == 'groupid' }.data end |
#inspect ⇒ Object
77 78 79 |
# File 'lib/keepassx/entry.rb', line 77 def inspect "Entry<title=#{title.inspect}, username=[FILTERED], password=[FILTERED], notes=#{notes.inspect}>" end |
#length ⇒ Object
53 54 55 |
# File 'lib/keepassx/entry.rb', line 53 def length @fields.map(&:length).reduce(&:+) end |
#notes ⇒ Object
57 58 59 |
# File 'lib/keepassx/entry.rb', line 57 def notes @fields.detect { |field| field.name == 'notes' }.data.chomp("\000") end |
#password ⇒ Object
61 62 63 |
# File 'lib/keepassx/entry.rb', line 61 def password @fields.detect { |field| field.name == 'password' }.data.chomp("\000") end |
#title ⇒ Object
65 66 67 |
# File 'lib/keepassx/entry.rb', line 65 def title @fields.detect { |field| field.name == 'title' }.data.chomp("\000") end |
#username ⇒ Object
69 70 71 |
# File 'lib/keepassx/entry.rb', line 69 def username @fields.detect { |field| field.name == 'username' }.data.chomp("\000") end |