From e99b18519db246afeccb990959f602e4e6b5b79b Mon Sep 17 00:00:00 2001 From: Adrien Waksberg Date: Tue, 28 Mar 2017 23:13:45 +0200 Subject: [PATCH] replace var.length == 0 by var.empty? --- lib/mpw/cli.rb | 8 ++++---- lib/mpw/mpw.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) 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