summaryrefslogtreecommitdiffstats
path: root/lib/redmine
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2019-10-22 12:40:33 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2019-10-22 12:40:33 +0000
commit69c4cfd82a7baf194e5f495114797e83b82fb4f4 (patch)
treebe47355ea4b82ced996fe51dd02b8796488baaf8 /lib/redmine
parenta49307b00213a5c4f823aaf3ebceb144e749a12d (diff)
downloadredmine-69c4cfd82a7baf194e5f495114797e83b82fb4f4.tar.gz
redmine-69c4cfd82a7baf194e5f495114797e83b82fb4f4.zip
use "class << self" syntax for Redmine::Views::Builders#for (#32308)
git-svn-id: http://svn.redmine.org/redmine/trunk@18817 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine')
-rw-r--r--lib/redmine/views/builders.rb22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/redmine/views/builders.rb b/lib/redmine/views/builders.rb
index 2e04026ac..b293b0428 100644
--- a/lib/redmine/views/builders.rb
+++ b/lib/redmine/views/builders.rb
@@ -23,18 +23,20 @@ require 'redmine/views/builders/xml'
module Redmine
module Views
module Builders
- def self.for(format, request, response, &block)
- builder =
- case format
- when 'xml', :xml then Builders::Xml.new(request, response)
- when 'json', :json then Builders::Json.new(request, response)
+ class << self
+ def for(format, request, response, &block)
+ builder =
+ case format
+ when 'xml', :xml then Builders::Xml.new(request, response)
+ when 'json', :json then Builders::Json.new(request, response)
+ else
+ raise "No builder for format #{format}"
+ end
+ if block_given?
+ block.call(builder)
else
- raise "No builder for format #{format}"
+ builder
end
- if block_given?
- block.call(builder)
- else
- builder
end
end
end