mirror of
https://github.com/nishiki/manage-password.git
synced 2024-11-27 15:43:04 +00:00
minor fix for the syntax
This commit is contained in:
parent
4e4efb8979
commit
1eac4001d9
1 changed files with 9 additions and 9 deletions
18
lib/MPW.rb
18
lib/MPW.rb
|
@ -77,7 +77,7 @@ module MPW
|
||||||
search = search.downcase
|
search = search.downcase
|
||||||
end
|
end
|
||||||
|
|
||||||
@data.each do |id, row|
|
@data.each_value do |row|
|
||||||
name = row['name'].nil? ? nil : row['name'].downcase
|
name = row['name'].nil? ? nil : row['name'].downcase
|
||||||
server = row['host'].nil? ? nil : row['host'].downcase
|
server = row['host'].nil? ? nil : row['host'].downcase
|
||||||
comment = row['comment'].nil? ? nil : row['comment'].downcase
|
comment = row['comment'].nil? ? nil : row['comment'].downcase
|
||||||
|
@ -93,11 +93,11 @@ module MPW
|
||||||
end
|
end
|
||||||
|
|
||||||
# Search in some csv data
|
# Search in some csv data
|
||||||
# @args: id_search -> the id item
|
# @args: id -> the id item
|
||||||
# @rtrn: a row with the resultat of the search
|
# @rtrn: a row with the resultat of the search
|
||||||
def search_by_id(id_search)
|
def search_by_id(id)
|
||||||
@data.each do |id, row|
|
@data.each_value do |row|
|
||||||
return row if id == id_search
|
return row if row['id'] == id
|
||||||
end
|
end
|
||||||
|
|
||||||
return []
|
return []
|
||||||
|
@ -158,8 +158,8 @@ module MPW
|
||||||
# @args: id -> the item's identifiant
|
# @args: id -> the item's identifiant
|
||||||
# @rtrn: true if the item has been deleted
|
# @rtrn: true if the item has been deleted
|
||||||
def remove(id)
|
def remove(id)
|
||||||
@data.each do |k, row|
|
@data.each_value do |row|
|
||||||
if k == id
|
if row['id'] == id
|
||||||
@data.delete(id)
|
@data.delete(id)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -211,7 +211,7 @@ module MPW
|
||||||
end
|
end
|
||||||
|
|
||||||
when :yaml
|
when :yaml
|
||||||
YAML::load_file(file).each do |k, row|
|
YAML::load_file(file).each_value do |row|
|
||||||
if not update(row['name'], row['group'], row['host'], row['protocol'], row['login'], row['password'], row['port'], row['comment'])
|
if not update(row['name'], row['group'], row['host'], row['protocol'], row['login'], row['password'], row['port'], row['comment'])
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -262,7 +262,7 @@ module MPW
|
||||||
@error_msg = I18n.t('error.sync.array')
|
@error_msg = I18n.t('error.sync.array')
|
||||||
return false
|
return false
|
||||||
else not data_remote.to_s.empty?
|
else not data_remote.to_s.empty?
|
||||||
@data.each do |lk, l|
|
@data.each_value do |l|
|
||||||
j = 0
|
j = 0
|
||||||
update = false
|
update = false
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue