diff --git a/lib/mpw/cli.rb b/lib/mpw/cli.rb index 1807f75..991388c 100644 --- a/lib/mpw/cli.rb +++ b/lib/mpw/cli.rb @@ -224,7 +224,7 @@ class Cli def list(options={}) result = @mpw.list(options) - if result.length == 0 + if result.empty? puts I18n.t('display.nothing') else table_items(result) @@ -414,7 +414,7 @@ class Cli def update(password=false, options={}) items = @mpw.list(options) - if items.length == 0 + if items.empty? puts "#{I18n.t('display.warning')}: #{I18n.t('warning.select')}".yellow else table_items(items) if items.length > 1 @@ -439,7 +439,7 @@ class Cli def delete(options={}) items = @mpw.list(options) - if items.length == 0 + if items.empty? puts "#{I18n.t('display.warning')}: #{I18n.t('warning.select')}".yellow else table_items(items) @@ -464,7 +464,7 @@ class Cli def copy(clipboard=true, options={}) items = @mpw.list(options) - if items.length == 0 + if items.empty? puts I18n.t('display.nothing') else table_items(items) diff --git a/lib/mpw/mpw.rb b/lib/mpw/mpw.rb index 70f3847..811a7a1 100644 --- a/lib/mpw/mpw.rb +++ b/lib/mpw/mpw.rb @@ -62,7 +62,7 @@ class MPW when /^wallet\/keys\/(?.+)\.pub$/ key = Regexp.last_match('key') - if GPGME::Key.find(:public, key).length == 0 + if GPGME::Key.find(:public, key).empty? GPGME::Key.import(f.read, armor: true) end