Module: Keepassx::Database::Finder
- Included in:
- Keepassx::Database
- Defined in:
- lib/keepassx/database/finder.rb
Instance Method Summary collapse
-
#find_entries(opts = {}, &block) ⇒ Array<Keepassx::Entry>
Get all matching entries.
-
#find_entry(opts = {}, &block) ⇒ Keepassx::Entry
Get the first matching entry.
-
#find_group(opts = {}, &block) ⇒ Keepassx::Group
Get the first matching group.
-
#find_groups(opts = {}, &block) ⇒ Array<Keepassx::Group>
Get all matching groups.
- #search(pattern) ⇒ Object
Instance Method Details
#find_entries(opts = {}, &block) ⇒ Array<Keepassx::Entry>
Get all matching entries.
37 38 39 |
# File 'lib/keepassx/database/finder.rb', line 37 def find_entries(opts = {}, &block) find :entry, opts, &block end |
#find_entry(opts = {}, &block) ⇒ Keepassx::Entry
Get the first matching entry.
10 11 12 13 |
# File 'lib/keepassx/database/finder.rb', line 10 def find_entry(opts = {}, &block) entries = find_entries(opts, &block) filter_list(entries) end |
#find_group(opts = {}, &block) ⇒ Keepassx::Group
Get the first matching group.
19 20 21 22 |
# File 'lib/keepassx/database/finder.rb', line 19 def find_group(opts = {}, &block) groups = find_groups(opts, &block) filter_list(groups) end |
#find_groups(opts = {}, &block) ⇒ Array<Keepassx::Group>
Get all matching groups.
29 30 31 |
# File 'lib/keepassx/database/finder.rb', line 29 def find_groups(opts = {}, &block) find :group, opts, &block end |
#search(pattern) ⇒ Object
42 43 44 45 46 |
# File 'lib/keepassx/database/finder.rb', line 42 def search(pattern) backup = groups.find { |g| g.name == 'Backup' } backup_group_id = backup&.id entries.select { |e| e.group_id != backup_group_id && e.name =~ /#{pattern}/i } end |