Class: SafariBookmarksParser::Commands::DupsCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- SafariBookmarksParser::Commands::DupsCommand
- Defined in:
- lib/safari_bookmarks_parser/commands/dups_command.rb
Instance Attribute Summary collapse
-
#exclude_reading_list ⇒ Object
readonly
Returns the value of attribute exclude_reading_list.
Attributes inherited from BaseCommand
#output_format, #output_path, #plist_path
Instance Method Summary collapse
-
#initialize(argv) ⇒ DupsCommand
constructor
A new instance of DupsCommand.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ DupsCommand
Returns a new instance of DupsCommand.
8 9 10 11 12 |
# File 'lib/safari_bookmarks_parser/commands/dups_command.rb', line 8 def initialize(argv) @exclude_reading_list = false super end |
Instance Attribute Details
#exclude_reading_list ⇒ Object (readonly)
Returns the value of attribute exclude_reading_list.
6 7 8 |
# File 'lib/safari_bookmarks_parser/commands/dups_command.rb', line 6 def exclude_reading_list @exclude_reading_list end |
Instance Method Details
#run ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/safari_bookmarks_parser/commands/dups_command.rb', line 14 def run plist_parser = Parser.parse(@plist_path) bookmarks = bookmarks_to_process(plist_parser).to_a duplicated_bookmark_groups = Services::FindDuplicatedBookmarks.call(bookmarks: bookmarks) return if duplicated_bookmark_groups.empty? duplicated_bookmark_groups = duplicated_bookmark_groups.map do |group| group.map(&:to_h) end text = format_to_text(duplicated_bookmark_groups) output_text(text) end |