Project

General

Profile

Actions

Patch #40802

closed

Support builder 3.3.0

Added by Pavel Rosický 24 days ago. Updated 9 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Gems support
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

== Version 3.3.0

unfortunately, this change breaks Redmine's API. LoadError: cannot load such file -- blankslate

the following patch removes that dependency in favor of BasicObject

diff --git a/lib/redmine/views/builders/json.rb b/lib/redmine/views/builders/json.rb
index 47ce0cc9b..011c16e58 100644
--- a/lib/redmine/views/builders/json.rb
+++ b/lib/redmine/views/builders/json.rb
@@ -28,7 +28,7 @@ module Redmine
         def initialize(request, response)
           super
           callback = request.params[:callback] || request.params[:jsonp]
-          if callback && Setting.jsonp_enabled?
+          if callback && ::Setting.jsonp_enabled?
             self.jsonp = callback.to_s.gsub(/[^a-zA-Z0-9_.]/, '')
           end
         end
diff --git a/lib/redmine/views/builders/structure.rb b/lib/redmine/views/builders/structure.rb
index f4524143f..ab1e3e411 100644
--- a/lib/redmine/views/builders/structure.rb
+++ b/lib/redmine/views/builders/structure.rb
@@ -17,12 +17,10 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

-require 'blankslate'
-
 module Redmine
   module Views
     module Builders
-      class Structure < BlankSlate
+      class Structure < BasicObject
         def initialize(request, response)
           @struct = [{}]
           @request = request
@@ -38,7 +36,7 @@ module Redmine
         end

         def encode_value(value)
-          if value.is_a?(Time)
+          if value.is_a?(::Time)
             # Rails uses a global setting to format JSON times
             # Don't rely on it for the API as it could have been changed
             value.xmlschema(0)
@@ -49,15 +47,15 @@ module Redmine

         def method_missing(sym, *args, &block)
           if args.count > 0
-            if args.first.is_a?(Hash)
-              if @struct.last.is_a?(Array)
+            if args.first.is_a?(::Hash)
+              if @struct.last.is_a?(::Array)
                 @struct.last << args.first unless block
               else
                 @struct.last[sym] = args.first
               end
             else
               value = encode_value(args.first)
-              if @struct.last.is_a?(Array)
+              if @struct.last.is_a?(::Array)
                 if args.size == 1 && !block
                   @struct.last << value
                 else
@@ -69,13 +67,13 @@ module Redmine
             end
           end
           if block
-            @struct << (args.first.is_a?(Hash) ? args.first : {})
+            @struct << (args.first.is_a?(::Hash) ? args.first : {})
             yield(self)
             ret = @struct.pop
-            if @struct.last.is_a?(Array)
+            if @struct.last.is_a?(::Array)
               @struct.last << ret
             else
-              if @struct.last.has_key?(sym) && @struct.last[sym].is_a?(Hash)
+              if @struct.last.has_key?(sym) && @struct.last[sym].is_a?(::Hash)
                 @struct.last[sym].merge! ret
               else
                 @struct.last[sym] = ret

Actions

Also available in: Atom PDF