Skip to content

Commit

Permalink
Preferred defaulting opts to {} in method declaration, preferring fla…
Browse files Browse the repository at this point in the history
…t_map over collect.flatten
  • Loading branch information
abellotti committed Mar 22, 2017
1 parent f7715b5 commit 30ea361
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions app/models/ext_management_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,7 @@ def last_refresh_status
end
end

def refresh_ems(opts = nil)
opts ||= {}
def refresh_ems(opts = {})
if missing_credentials?
raise _("no %{table} credentials defined") % {:table => ui_lookup(:table => "ext_management_systems")}
end
Expand Down
5 changes: 2 additions & 3 deletions app/models/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,13 @@ def my_zone
end
alias_method :zone_name, :my_zone

def refresh_ems(opts = nil)
opts ||= {}
def refresh_ems(opts = {})
if missing_credentials?
raise _("no %{table} credentials defined") % {:table => ui_lookup(:table => "provider")}
end
unless authentication_status_ok?
raise _("%{table} failed last authentication check") % {:table => ui_lookup(:table => "provider")}
end
managers.collect { |manager| EmsRefresh.queue_refresh(manager, nil, opts) }.flatten
managers.flat_map { |manager| EmsRefresh.queue_refresh(manager, nil, opts) }
end
end

0 comments on commit 30ea361

Please sign in to comment.