Skip to content

Commit

Permalink
Merge pull request #2756 from refinery/refactorcop
Browse files Browse the repository at this point in the history
Refactorcop refactors
  • Loading branch information
simi committed Dec 28, 2014
2 parents cb4903a + 1f718d2 commit a42907c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion core/lib/refinery/admin/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def group_by_date(records)

records.each do |record|
key = record.created_at.strftime("%Y-%m-%d")
record_group = new_records.collect{ |records| records.last if records.first == key }.flatten.compact << record
record_group = new_records.map{ |r| r.last if r.first == key }.flatten.compact << record
(new_records.delete_if { |i| i.first == key}) << [key, record_group]
end

Expand Down
2 changes: 1 addition & 1 deletion core/lib/refinery/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def uncrudify(controller, action)
if (matches = crud_lines.scan(/(\ +)(def #{action}.+?protected)/m).first).present? &&
(method_lines = "#{matches.last.split(%r{^#{matches.first}end}).first.strip}\nend".split("\n")).many?
indent = method_lines.second.index %r{[^ ]}
crud_method = method_lines.join("\n").gsub /^#{" " * indent}/, " "
crud_method = method_lines.join("\n").gsub(/^#{" " * indent}/, " ")

crud_options = controller_class.try(:crudify_options) || {}
crud_method.gsub! '#{options[:redirect_to_url]}', crud_options[:redirect_to_url].to_s
Expand Down
4 changes: 2 additions & 2 deletions core/lib/refinery/core/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def refinery_inclusion!
config.autoload_paths += %W( #{config.root}/lib )

# Include the refinery controllers and helpers dynamically
config.to_prepare &method(:refinery_inclusion!).to_proc
config.to_prepare(&method(:refinery_inclusion!).to_proc)

after_inclusion &method(:register_decorators!).to_proc
after_inclusion(&method(:register_decorators!).to_proc)

# Wrap errors in spans
config.to_prepare do
Expand Down
2 changes: 1 addition & 1 deletion core/lib/refinery/ext/action_view/helpers/form_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def label_humanize_text(method, options = {})
object.class.human_attribute_name(method)
end

content ||= method.humanize
content || method.humanize
end

end
2 changes: 1 addition & 1 deletion pages/app/presenters/refinery/pages/menu_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def menu_match_is_available?(item, path)
def find_url_for(item)
url = [item.url]
url << ['', item.url[:path]].compact.flatten.join('/') if item.url.respond_to?(:keys)
url = url.last.match(%r{^/#{::I18n.locale.to_s}(/.*)}) ? $1 : url.detect{ |u| u.is_a?(String)}
url.last.match(%r{^/#{::I18n.locale.to_s}(/.*)}) ? $1 : url.detect{ |u| u.is_a?(String) }
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion pages/lib/refinery/pages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def valid_templates(*pattern)
def default_parts_for(page)
return default_parts unless page.view_template.present?

types.find_by_name(page.view_template).parts.map &:titleize
types.find_by_name(page.view_template).parts.map(&:titleize)
end
end

Expand Down

0 comments on commit a42907c

Please sign in to comment.