]> source.dussan.org Git - redmine.git/commitdiff
Merged r22863 from trunk to 5.0-stable (#40802).
authorGo MAEDA <maeda@farend.jp>
Sat, 8 Jun 2024 07:33:15 +0000 (07:33 +0000)
committerGo MAEDA <maeda@farend.jp>
Sat, 8 Jun 2024 07:33:15 +0000 (07:33 +0000)
git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@22865 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/views/builders/json.rb
lib/redmine/views/builders/structure.rb

index 47ce0cc9b7d05dd588ab17f3eeb408710a03111e..011c16e58136adace13cabcece4e220822740573 100644 (file)
@@ -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
index 419401c7327ec9dc0f40b00d9a0e7f226a995c26..ab1e3e4114ca1243e82f427d7a0eca861c0b6ae1 100644 (file)
 # 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,16 +47,16 @@ 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 args.size == 1 && !block_given?
+              if @struct.last.is_a?(::Array)
+                if args.size == 1 && !block
                   @struct.last << value
                 else
                   @struct.last << (args.last || {}).merge(:value => value)
@@ -68,14 +66,14 @@ module Redmine
               end
             end
           end
-          if block_given?
-            @struct << (args.first.is_a?(Hash) ? args.first : {})
+          if block
+            @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