1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2025-02-20 01:50:04 +00:00

fix syntax for options in method

This commit is contained in:
Adrien Waksberg 2017-03-30 19:40:04 +02:00
parent 002ec2175b
commit 3c787371b3
3 changed files with 8 additions and 8 deletions

View file

@ -218,7 +218,7 @@ class Cli
# Display the query's result
# @args: options -> the option to search
def list(options = {})
def list(**options)
result = @mpw.list(options)
if result.empty?
@ -406,7 +406,7 @@ class Cli
# Update an item
# @args: password -> generate a random password
# options -> the option to search
def update(password = false, options = {})
def update(password = false, **options)
items = @mpw.list(options)
if items.empty?
@ -431,7 +431,7 @@ class Cli
# Remove an item
# @args: options -> the option to search
def delete(options = {})
def delete(**options)
items = @mpw.list(options)
if items.empty?
@ -456,7 +456,7 @@ class Cli
# Copy a password, otp, login
# @args: clipboard -> enable clipboard
# options -> the option to search
def copy(clipboard = true, options = {})
def copy(clipboard = true, **options)
items = @mpw.list(options)
if items.empty?

View file

@ -35,7 +35,7 @@ class Item
# Create a new item
# @args: options -> a hash of parameter
# raise an error if the hash hasn't the key name
def initialize(options = {})
def initialize(**options)
if !options.key?(:host) || options[:host].to_s.empty?
raise I18n.t('error.update.host_empty')
end
@ -55,7 +55,7 @@ class Item
# Update the item
# @args: options -> a hash of parameter
def update(options = {})
def update(**options)
if options.key?(:host) && options[:host].to_s.empty?
raise I18n.t('error.update.host_empty')
end

View file

@ -223,7 +223,7 @@ class MPW
# Set config
# args: config -> a hash with config options
def set_config(options = {})
def set_config(**options)
@config = {} if @config.nil?
@config['protocol'] = options[:protocol] if options.key?(:protocol)
@ -246,7 +246,7 @@ class MPW
# Search in some csv data
# @args: options -> a hash with paramaters
# @rtrn: a list with the resultat of the search
def list(options = {})
def list(**options)
result = []
search = options[:pattern].to_s.downcase