lib/keepassx/utilities.rb in ruby-keepassx-0.2.0 vs lib/keepassx/utilities.rb in ruby-keepassx-0.2.1
- old
+ new
@@ -107,13 +107,13 @@
# If group is first entry or has level equal 0,
# it gets parent set to nil
if previous_group.nil? or group.level.eql? 0
group.parent = nil
- # If group has level greater than parent's level by one,
- # it gets parent set to the first previous group with level less
- # than group's level by one
+ # If group has level greater than parent's level by one,
+ # it gets parent set to the first previous group with level less
+ # than group's level by one
elsif group.level == previous_group.level + 1 or
group.level == previous_group.level
group.parent = previous_group
@@ -185,10 +185,10 @@
groups, entries = opts[:groups], opts[:entries]
# Remove groups and entries from options, so new group could be
# initialized from incoming Hash
fields = Keepassx::Group.fields
- group_opts = opts.select { |k, _| fields.include? k }
+ group_opts = opts.reject { |k, _| !fields.include? k }
group = add_group group_opts
entries.each do |e|
entry = e.clone
add_entry entry.merge(:group => group)