Commit 4e5412d0 authored by maeda's avatar maeda

Remove trailing whitespaces from lib (#31506).

Patch by Marius BALTEANU.


git-svn-id: https://svn.redmine.org/redmine/trunk@18231 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent ddcb9854
......@@ -58,7 +58,7 @@ module Redmine
end
@hours << h
end
@hours.each do |row|
case @columns
when 'year'
......@@ -71,13 +71,13 @@ module Redmine
row['day'] = "#{row['spent_on']}"
end
end
min = @hours.collect {|row| row['spent_on']}.min
@from = min ? min.to_date : User.current.today
max = @hours.collect {|row| row['spent_on']}.max
@to = max ? max.to_date : User.current.today
@total_hours = @hours.inject(0) {|s,k| s = s + k['hours'].to_f}
@periods = []
......
......@@ -26,7 +26,7 @@ module Redmine
# URLs relative to the current document or document root (without a protocol
# separator, should be harmless
return true unless uri.to_s.include? ":"
# Other URLs need to be parsed
schemes.include? URI.parse(uri).scheme
rescue URI::Error
......
......@@ -67,11 +67,11 @@ module Redmine
end
end
end
def controller
nil
end
def config
ActionController::Base.config
end
......
......@@ -86,19 +86,19 @@ module Redmine
if parent
previous_root_id = root_id
self.root_id = parent.root_id
lft_after_move = target_lft
self.class.where(:root_id => parent.root_id).update_all([
"lft = CASE WHEN lft >= :lft THEN lft + :shift ELSE lft END, " +
"rgt = CASE WHEN rgt >= :lft THEN rgt + :shift ELSE rgt END",
{:lft => lft_after_move, :shift => (rgt - lft + 1)}
])
self.class.where(:root_id => previous_root_id).update_all([
"root_id = :root_id, lft = lft + :shift, rgt = rgt + :shift",
{:root_id => parent.root_id, :shift => lft_after_move - lft}
])
self.lft, self.rgt = lft_after_move, (rgt - lft + lft_after_move)
parent.send :reload_nested_set_values
end
......@@ -107,7 +107,7 @@ module Redmine
def remove_from_nested_set
self.class.where(:root_id => root_id).where("lft >= ? AND rgt <= ?", lft, rgt).
update_all(["root_id = :id, lft = lft - :shift, rgt = rgt - :shift", {:id => id, :shift => lft - 1}])
self.class.where(:root_id => root_id).update_all([
"lft = CASE WHEN lft >= :lft THEN lft - :shift ELSE lft END, " +
"rgt = CASE WHEN rgt >= :lft THEN rgt - :shift ELSE rgt END",
......
......@@ -398,7 +398,7 @@ module Redmine
# * :label - label for the formatter displayed in application settings
#
# Examples:
# wiki_format_provider(:custom_formatter, CustomFormatter, :label => "My custom formatter")
# wiki_format_provider(:custom_formatter, CustomFormatter, :label => "My custom formatter")
#
def wiki_format_provider(name, *args)
Redmine::WikiFormatting.register(name, *args)
......
......@@ -34,7 +34,7 @@ module Redmine
@safe_attributes ||= []
if args.empty?
if superclass.include?(Redmine::SafeAttributes)
@safe_attributes + superclass.safe_attributes
@safe_attributes + superclass.safe_attributes
else
@safe_attributes
end
......
......@@ -294,7 +294,7 @@ module Redmine
full_args_locale << scm_iconv(@path_encoding, 'UTF-8', e)
end
ret = shellout(
self.class.sq_bin + ' ' +
self.class.sq_bin + ' ' +
full_args_locale.map { |e| shell_quote e.to_s }.join(' '),
&block
)
......@@ -313,7 +313,7 @@ module Redmine
full_args_locale << scm_iconv(@path_encoding, 'UTF-8', e)
end
ret = shellout(
self.class.sq_bin + ' ' +
self.class.sq_bin + ' ' +
full_args_locale.map { |e| shell_quote e.to_s }.join(' '),
&block
)
......
......@@ -31,11 +31,11 @@ module Redmine
def self.to_text(html)
html = html.gsub(/[\n\r]/, '').squeeze(' ')
doc = Loofah.document(html)
doc.scrub!(WikiTags.new(tags))
doc.scrub!(:newline_block_elements)
Loofah.remove_extraneous_whitespace(doc.text).strip
end
......@@ -44,7 +44,7 @@ module Redmine
@direction = :bottom_up
@tags_to_text = tags_to_text || {}
end
def scrub(node)
formatting = @tags_to_text[node.name]
case formatting
......
......@@ -69,7 +69,7 @@ module Redmine
# macro :my_macro do |obj, args|
# "My macro output"
# end
#
#
# desc "This is my macro that accepts a block of text"
# macro :my_macro do |obj, args, text|
# "My macro output"
......@@ -83,7 +83,7 @@ module Redmine
#
# Options:
# * :desc - A description of the macro
# * :parse_args => false - Disables arguments parsing (the whole arguments
# * :parse_args => false - Disables arguments parsing (the whole arguments
# string is passed to the macro)
#
# Macro blocks accept 2 or 3 arguments:
......@@ -91,7 +91,7 @@ module Redmine
# * args: macro arguments
# * text: the block of text given to the macro (should be present only if the
# macro accepts a block of text). text is a String or nil if the macro is
# invoked without a block of text.
# invoked without a block of text.
#
# Examples:
# By default, when the macro is invoked, the comma separated list of arguments
......@@ -164,7 +164,7 @@ module Redmine
# Builtin macros
desc "Sample macro."
macro :hello_world do |obj, args, text|
h("Hello world! Object: #{obj.class.name}, " +
h("Hello world! Object: #{obj.class.name}, " +
(args.empty? ? "Called with no argument" : "Arguments: #{args.join(', ')}") +
" and " + (text.present? ? "a #{text.size} bytes long block of text." : "no block of text.")
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment