Skip to content

Commit

Permalink
break apart complex method
Browse files Browse the repository at this point in the history
  • Loading branch information
dvanderbeek committed May 11, 2016
1 parent a01d406 commit 3c5c82e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/responders/flash_responder.rb
Expand Up @@ -147,12 +147,6 @@ def set_flash_message? #:nodoc:
end

def mount_i18n_options(status) #:nodoc:
resource_name = if resource.class.respond_to?(:model_name)
resource.class.model_name.human
else
resource.class.name.underscore.humanize
end

options = {
:default => flash_defaults_by_namespace(status),
:resource_name => resource_name,
Expand All @@ -166,6 +160,14 @@ def mount_i18n_options(status) #:nodoc:
options
end

def resource_name
if resource.class.respond_to?(:model_name)
resource.class.model_name.human
else
resource.class.name.underscore.humanize
end
end

def flash_defaults_by_namespace(status) #:nodoc:
defaults = []
slices = controller.controller_path.split('/')
Expand Down

0 comments on commit 3c5c82e

Please sign in to comment.