Rubocop: Style/DeprecatedHashMethods
- Hash#has_key? is deprecated in favor of Hash#key? Add method `key?` to Drop
This commit is contained in:
		
							parent
							
								
									98a19cdf2b
								
							
						
					
					
						commit
						ff5f7b7120
					
				|  | @ -83,6 +83,19 @@ module Jekyll | ||||||
|         end |         end | ||||||
|       end |       end | ||||||
| 
 | 
 | ||||||
|  |       # Check if key exists in Drop | ||||||
|  |       # | ||||||
|  |       # key - the string key whose value to fetch | ||||||
|  |       # | ||||||
|  |       # Returns true if the given key is present | ||||||
|  |       def key?(key) | ||||||
|  |         if self.class.mutable && @mutations.key?(key) | ||||||
|  |           true | ||||||
|  |         else | ||||||
|  |           respond_to?(key) || fallback_data.key?(key) | ||||||
|  |         end | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|       # Generates a list of keys with user content as their values. |       # Generates a list of keys with user content as their values. | ||||||
|       # This gathers up the Drop methods and keys of the mutations and |       # This gathers up the Drop methods and keys of the mutations and | ||||||
|       # underlying data hashes and performs a set union to ensure a list |       # underlying data hashes and performs a set union to ensure a list | ||||||
|  |  | ||||||
|  | @ -90,7 +90,7 @@ module Jekyll | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     def applies_path?(scope, path) |     def applies_path?(scope, path) | ||||||
|       return true if !scope.has_key?('path') || scope['path'].empty? |       return true if !scope.key?('path') || scope['path'].empty? | ||||||
| 
 | 
 | ||||||
|       scope_path = Pathname.new(scope['path']) |       scope_path = Pathname.new(scope['path']) | ||||||
|       Pathname.new(sanitize_path(path)).ascend do |path| |       Pathname.new(sanitize_path(path)).ascend do |path| | ||||||
|  | @ -150,7 +150,7 @@ module Jekyll | ||||||
|     # Returns an array of hashes |     # Returns an array of hashes | ||||||
|     def matching_sets(path, type) |     def matching_sets(path, type) | ||||||
|       valid_sets.select do |set| |       valid_sets.select do |set| | ||||||
|         !set.has_key?('scope') || applies?(set['scope'], path, type) |         !set.key?('scope') || applies?(set['scope'], path, type) | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -90,7 +90,7 @@ module Jekyll | ||||||
|       return true if path.nil? |       return true if path.nil? | ||||||
| 
 | 
 | ||||||
|       # Check for path in cache |       # Check for path in cache | ||||||
|       if cache.has_key? path |       if cache.key? path | ||||||
|         return cache[path] |         return cache[path] | ||||||
|       end |       end | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -115,7 +115,7 @@ eos | ||||||
|         validate_path(path, dir, site.safe) |         validate_path(path, dir, site.safe) | ||||||
| 
 | 
 | ||||||
|         # Add include to dependency tree |         # Add include to dependency tree | ||||||
|         if context.registers[:page] && context.registers[:page].has_key?("path") |         if context.registers[:page] && context.registers[:page].key?("path") | ||||||
|           site.regenerator.add_dependency( |           site.regenerator.add_dependency( | ||||||
|             site.in_source_dir(context.registers[:page]["path"]), |             site.in_source_dir(context.registers[:page]["path"]), | ||||||
|             path |             path | ||||||
|  | @ -138,7 +138,7 @@ eos | ||||||
|         context.registers[:cached_partials] ||= {} |         context.registers[:cached_partials] ||= {} | ||||||
|         cached_partial = context.registers[:cached_partials] |         cached_partial = context.registers[:cached_partials] | ||||||
| 
 | 
 | ||||||
|         if cached_partial.has_key?(path) |         if cached_partial.key?(path) | ||||||
|           cached_partial[path] |           cached_partial[path] | ||||||
|         else |         else | ||||||
|           cached_partial[path] = context.registers[:site].liquid_renderer.file(path).parse(read_file(path, context)) |           cached_partial[path] = context.registers[:site].liquid_renderer.file(path).parse(read_file(path, context)) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue