From 0154f6589cd438c0389963416e25340bc55b4358 Mon Sep 17 00:00:00 2001 From: Richie Thomas Date: Tue, 10 Jan 2017 16:40:57 -0500 Subject: [PATCH] Changes most references of Fixnum class to Integer, to account for deprecation of Fixnum and Bignum classes in Ruby 2.4.0 (#2223) Closes #2218 --- lib/sass/engine.rb | 6 +++--- lib/sass/error.rb | 6 +++--- lib/sass/plugin/staleness_checker.rb | 4 ++-- lib/sass/script.rb | 4 ++-- lib/sass/script/functions.rb | 4 ++-- lib/sass/script/lexer.rb | 10 +++++----- lib/sass/script/parser.rb | 8 ++++---- lib/sass/script/tree/node.rb | 2 +- lib/sass/script/value/base.rb | 4 ++-- lib/sass/script/value/color.rb | 20 ++++++++++---------- lib/sass/script/value/number.rb | 2 +- lib/sass/scss/parser.rb | 4 ++-- lib/sass/scss/rx.rb | 2 +- lib/sass/selector/abstract_sequence.rb | 10 +++++----- lib/sass/selector/sequence.rb | 4 ++-- lib/sass/selector/simple.rb | 4 ++-- lib/sass/shared.rb | 2 +- lib/sass/source/map.rb | 4 ++-- lib/sass/source/position.rb | 8 ++++---- lib/sass/tree/comment_node.rb | 2 +- lib/sass/tree/node.rb | 2 +- lib/sass/tree/prop_node.rb | 2 +- lib/sass/tree/rule_node.rb | 2 +- lib/sass/util.rb | 16 ++++++++-------- lib/sass/version.rb | 4 ++-- diff --git a/lib/sass/engine.rb b/lib/sass/engine.rb index eb3c462..92a2e9f 100644 --- a/lib/sass/engine.rb +++ b/lib/sass/engine.rb @@ -94,13 +94,13 @@ class Engine # `text`: `String` # : The text in the line, without any whitespace at the beginning or end. # - # `tabs`: `Fixnum` + # `tabs`: `Integer` # : The level of indentation of the line. # - # `index`: `Fixnum` + # `index`: `Integer` # : The line number in the original document. # - # `offset`: `Fixnum` + # `offset`: `Integer` # : The number of bytes in on the line that the text begins. # This ends up being the number of bytes of leading whitespace. # diff --git a/lib/sass/error.rb b/lib/sass/error.rb index 319ff12..f4763a9 100644 --- a/lib/sass/error.rb +++ b/lib/sass/error.rb @@ -69,14 +69,14 @@ def sass_filename # The name of the mixin in which the error occurred. # This could be `nil` if the error occurred outside a mixin. # - # @return [Fixnum] + # @return [String] def sass_mixin sass_backtrace.first[:mixin] end # The line of the Sass template on which the error occurred. # - # @return [Fixnum] + # @return [Integer] def sass_line sass_backtrace.first[:line] end @@ -153,7 +153,7 @@ class << self # Returns an error report for an exception in CSS format. # # @param e [Exception] - # @param line_offset [Fixnum] The number of the first line of the Sass template. + # @param line_offset [Integer] The number of the first line of the Sass template. # @return [String] The error report # @raise [Exception] `e`, if the # {file:SASS_REFERENCE.md#full_exception-option `:full_exception`} option diff --git a/lib/sass/plugin/staleness_checker.rb b/lib/sass/plugin/staleness_checker.rb index 23a9bf2..8ff1fd2 100644 --- a/lib/sass/plugin/staleness_checker.rb +++ b/lib/sass/plugin/staleness_checker.rb @@ -72,7 +72,7 @@ def stylesheet_needs_update?(css_file, template_file, importer = nil) # Returns whether a Sass or SCSS stylesheet has been modified since a given time. # # @param template_file [String] The location of the Sass or SCSS template. - # @param mtime [Fixnum] The modification time to check against. + # @param mtime [Time] The modification time to check against. # @param importer [Sass::Importers::Base] The importer used to locate the stylesheet. # Defaults to the filesystem importer. # @return [Boolean] Whether the stylesheet has been modified. @@ -103,7 +103,7 @@ def self.stylesheet_needs_update?(css_file, template_file, importer = nil) # so it's better to use when checking multiple stylesheets at once. # # @param template_file [String] The location of the Sass or SCSS template. - # @param mtime [Fixnum] The modification time to check against. + # @param mtime [Time] The modification time to check against. # @param importer [Sass::Importers::Base] The importer used to locate the stylesheet. # Defaults to the filesystem importer. # @return [Boolean] Whether the stylesheet has been modified. diff --git a/lib/sass/script.rb b/lib/sass/script.rb index 5ca639d..315094e 100644 --- a/lib/sass/script.rb +++ b/lib/sass/script.rb @@ -16,9 +16,9 @@ module Script # Parses a string of SassScript # # @param value [String] The SassScript - # @param line [Fixnum] The number of the line on which the SassScript appeared. + # @param line [Integer] The number of the line on which the SassScript appeared. # Used for error reporting - # @param offset [Fixnum] The number of characters in on `line` that the SassScript started. + # @param offset [Integer] The number of characters in on `line` that the SassScript started. # Used for error reporting # @param options [{Symbol => Object}] An options hash; # see {file:SASS_REFERENCE.md#sass_options the Sass options documentation} diff --git a/lib/sass/script/functions.rb b/lib/sass/script/functions.rb index e964e1a..b20b553 100644 --- a/lib/sass/script/functions.rb +++ b/lib/sass/script/functions.rb @@ -431,8 +431,8 @@ def self.declare(method_name, args, options = {}) # If no signatures match, the first signature is returned for error messaging. # # @param method_name [Symbol] The name of the Ruby function to be called. - # @param arg_arity [Fixnum] The number of unnamed arguments the function was passed. - # @param kwarg_arity [Fixnum] The number of keyword arguments the function was passed. + # @param arg_arity [Integer] The number of unnamed arguments the function was passed. + # @param kwarg_arity [Integer] The number of keyword arguments the function was passed. # # @return [{Symbol => Object}, nil] # The signature options for the matching signature, diff --git a/lib/sass/script/lexer.rb b/lib/sass/script/lexer.rb index 2d7fceb..8ba3870 100644 --- a/lib/sass/script/lexer.rb +++ b/lib/sass/script/lexer.rb @@ -19,13 +19,13 @@ class Lexer # `source_range`: \[`Sass::Source::Range`\] # : The range in the source file in which the token appeared. # - # `pos`: \[`Fixnum`\] + # `pos`: \[`Integer`\] # : The scanner position at which the SassScript token appeared. Token = Struct.new(:type, :value, :source_range, :pos) # The line number of the lexer's current position. # - # @return [Fixnum] + # @return [Integer] def line return @line unless @tok @tok.source_range.start_pos.line @@ -34,7 +34,7 @@ def line # The number of bytes into the current line # of the lexer's current position (1-based). # - # @return [Fixnum] + # @return [Integer] def offset return @offset unless @tok @tok.source_range.start_pos.offset @@ -142,9 +142,9 @@ def string_re(open, close) } # @param str [String, StringScanner] The source text to lex - # @param line [Fixnum] The 1-based line on which the SassScript appears. + # @param line [Integer] The 1-based line on which the SassScript appears. # Used for error reporting and sourcemap building - # @param offset [Fixnum] The 1-based character (not byte) offset in the line in the source. + # @param offset [Integer] The 1-based character (not byte) offset in the line in the source. # Used for error reporting and sourcemap building # @param options [{Symbol => Object}] An options hash; # see {file:SASS_REFERENCE.md#sass_options the Sass options documentation} diff --git a/lib/sass/script/parser.rb b/lib/sass/script/parser.rb index 224083f..2d79900 100644 --- a/lib/sass/script/parser.rb +++ b/lib/sass/script/parser.rb @@ -8,22 +8,22 @@ module Script class Parser # The line number of the parser's current position. # - # @return [Fixnum] + # @return [Integer] def line @lexer.line end # The column number of the parser's current position. # - # @return [Fixnum] + # @return [Integer] def offset @lexer.offset end # @param str [String, StringScanner] The source text to parse - # @param line [Fixnum] The line on which the SassScript appears. + # @param line [Integer] The line on which the SassScript appears. # Used for error reporting and sourcemap building - # @param offset [Fixnum] The character (not byte) offset where the script starts in the line. + # @param offset [Integer] The character (not byte) offset where the script starts in the line. # Used for error reporting and sourcemap building # @param options [{Symbol => Object}] An options hash; see # {file:SASS_REFERENCE.md#sass_options the Sass options documentation}. diff --git a/lib/sass/script/tree/node.rb b/lib/sass/script/tree/node.rb index 2bc4e42..1e31bec 100644 --- a/lib/sass/script/tree/node.rb +++ b/lib/sass/script/tree/node.rb @@ -10,7 +10,7 @@ class Node # The line of the document on which this node appeared. # - # @return [Fixnum] + # @return [Integer] attr_accessor :line # The source range in the document on which this node appeared. diff --git a/lib/sass/script/value/base.rb b/lib/sass/script/value/base.rb index 51094e1..67a12e1 100644 --- a/lib/sass/script/value/base.rb +++ b/lib/sass/script/value/base.rb @@ -149,7 +149,7 @@ def unary_div # Returns the hash code of this value. Two objects' hash codes should be # equal if the objects are equal. # - # @return [Fixnum] The hash code. + # @return [Integer for Ruby 2.4.0+, Fixnum for earlier Ruby versions] The hash code. def hash value.hash end @@ -176,7 +176,7 @@ def ==(other) eq(other).to_bool end - # @return [Fixnum] The integer value of this value + # @return [Integer] The integer value of this value # @raise [Sass::SyntaxError] if this value isn't an integer def to_i raise Sass::SyntaxError.new("#{inspect} is not an integer.") diff --git a/lib/sass/script/value/color.rb b/lib/sass/script/value/color.rb index 5f12ca3..dabda4c 100644 --- a/lib/sass/script/value/color.rb +++ b/lib/sass/script/value/color.rb @@ -17,8 +17,8 @@ class Color < Base # @private # # Convert a ruby integer to a rgba components - # @param color [Fixnum] - # @return [Array] Array of 4 numbers representing r,g,b and alpha + # @param color [Integer] + # @return [Array] Array of 4 numbers representing r,g,b and alpha def self.int_to_rgba(color) rgba = (0..3).map {|n| color >> (n << 3) & 0xff}.reverse rgba[-1] = rgba[-1] / 255.0 @@ -293,7 +293,7 @@ def self.from_hex(hex_string, alpha = nil) # The red component of the color. # - # @return [Fixnum] + # @return [Integer] def red hsl_to_rgb! @attrs[:red] @@ -301,7 +301,7 @@ def red # The green component of the color. # - # @return [Fixnum] + # @return [Integer] def green hsl_to_rgb! @attrs[:green] @@ -309,7 +309,7 @@ def green # The blue component of the color. # - # @return [Fixnum] + # @return [Integer] def blue hsl_to_rgb! @attrs[:blue] @@ -342,7 +342,7 @@ def lightness # The alpha channel (opacity) of the color. # This is 1 unless otherwise defined. # - # @return [Fixnum] + # @return [Integer] def alpha @attrs[:alpha].to_f end @@ -357,7 +357,7 @@ def alpha? # Returns the red, green, and blue components of the color. # - # @return [Array] A frozen three-element array of the red, green, and blue + # @return [Array] A frozen three-element array of the red, green, and blue # values (respectively) of the color def rgb [red, green, blue].freeze @@ -365,7 +365,7 @@ def rgb # Returns the red, green, blue, and alpha components of the color. # - # @return [Array] A frozen four-element array of the red, green, + # @return [Array] A frozen four-element array of the red, green, # blue, and alpha values (respectively) of the color def rgba [red, green, blue, alpha].freeze @@ -373,7 +373,7 @@ def rgba # Returns the hue, saturation, and lightness components of the color. # - # @return [Array] A frozen three-element array of the + # @return [Array] A frozen three-element array of the # hue, saturation, and lightness values (respectively) of the color def hsl [hue, saturation, lightness].freeze @@ -381,7 +381,7 @@ def hsl # Returns the hue, saturation, lightness, and alpha components of the color. # - # @return [Array] A frozen four-element array of the hue, + # @return [Array] A frozen four-element array of the hue, # saturation, lightness, and alpha values (respectively) of the color def hsla [hue, saturation, lightness, alpha].freeze diff --git a/lib/sass/script/value/number.rb b/lib/sass/script/value/number.rb index 1209a34..44502b4 100644 --- a/lib/sass/script/value/number.rb +++ b/lib/sass/script/value/number.rb @@ -306,7 +306,7 @@ def inspect(opts = {}) end alias_method :to_sass, :inspect - # @return [Fixnum] The integer value of the number + # @return [Integer] The integer value of the number # @raise [Sass::SyntaxError] if the number isn't an integer def to_i super unless int? diff --git a/lib/sass/scss/parser.rb b/lib/sass/scss/parser.rb index a5dbf1a..b686946 100644 --- a/lib/sass/scss/parser.rb +++ b/lib/sass/scss/parser.rb @@ -16,9 +16,9 @@ class Parser # warnings and source maps. # @param importer [Sass::Importers::Base] The importer used to import the # file being parsed. Used for source maps. - # @param line [Fixnum] The 1-based line on which the source string appeared, + # @param line [Integer] The 1-based line on which the source string appeared, # if it's part of another document. - # @param offset [Fixnum] The 1-based character (not byte) offset in the line on + # @param offset [Integer] The 1-based character (not byte) offset in the line on # which the source string starts. Used for error reporting and sourcemap # building. def initialize(str, filename, importer, line = 1, offset = 1) diff --git a/lib/sass/scss/rx.rb b/lib/sass/scss/rx.rb index f1a952f..dd9eede 100644 --- a/lib/sass/scss/rx.rb +++ b/lib/sass/scss/rx.rb @@ -40,7 +40,7 @@ def self.escape_char(c) # escaping all significant characters. # # @param str [String] The text of the regexp - # @param flags [Fixnum] Flags for the created regular expression + # @param flags [Integer] Flags for the created regular expression # @return [Regexp] # @private def self.quote(str, flags = 0) diff --git a/lib/sass/selector/abstract_sequence.rb b/lib/sass/selector/abstract_sequence.rb index ef78909..a18a79f 100644 --- a/lib/sass/selector/abstract_sequence.rb +++ b/lib/sass/selector/abstract_sequence.rb @@ -8,7 +8,7 @@ module Selector class AbstractSequence # The line of the Sass template on which this selector was declared. # - # @return [Fixnum] + # @return [Integer] attr_reader :line # The name of the file in which this selector was declared. @@ -19,8 +19,8 @@ class AbstractSequence # Sets the line of the Sass template on which this selector was declared. # This also sets the line for all child selectors. # - # @param line [Fixnum] - # @return [Fixnum] + # @param line [Integer] + # @return [Integer] def line=(line) members.each {|m| m.line = line} @line = line @@ -42,7 +42,7 @@ def filename=(filename) # Subclasses should define `#_hash` rather than overriding this method, # which automatically handles memoizing the result. # - # @return [Fixnum] + # @return [Integer] def hash @_hash ||= _hash end @@ -83,7 +83,7 @@ def to_s(opts = {}) # The base is given by {Sass::Selector::SPECIFICITY_BASE}. This can be a # number or a range representing possible specificities. # - # @return [Fixnum, Range] + # @return [Integer, Range] def specificity _specificity(members) end diff --git a/lib/sass/selector/sequence.rb b/lib/sass/selector/sequence.rb index 0abd930..3b51ea1 100644 --- a/lib/sass/selector/sequence.rb +++ b/lib/sass/selector/sequence.rb @@ -6,8 +6,8 @@ class Sequence < AbstractSequence # Sets the line of the Sass template on which this selector was declared. # This also sets the line for all child selectors. # - # @param line [Fixnum] - # @return [Fixnum] + # @param line [Integer] + # @return [Integer] def line=(line) members.each {|m| m.line = line if m.is_a?(SimpleSequence)} @line = line diff --git a/lib/sass/selector/simple.rb b/lib/sass/selector/simple.rb index df286f3..7d267d4 100644 --- a/lib/sass/selector/simple.rb +++ b/lib/sass/selector/simple.rb @@ -5,7 +5,7 @@ module Selector class Simple # The line of the Sass template on which this selector was declared. # - # @return [Fixnum] + # @return [Integer] attr_accessor :line # The name of the file in which this selector was declared, @@ -36,7 +36,7 @@ def to_s(opts = {}) # so if that contains information irrelevant to the identity of the selector, # this should be overridden. # - # @return [Fixnum] + # @return [Integer] def hash @_hash ||= equality_key.hash end diff --git a/lib/sass/shared.rb b/lib/sass/shared.rb index 9e9189c..1f50995 100644 --- a/lib/sass/shared.rb +++ b/lib/sass/shared.rb @@ -31,7 +31,7 @@ def handle_interpolation(str) # A `Fixnum` in 1.8, a `String` in 1.9 # @param finish [Character] The character closing the balanced pair. # A `Fixnum` in 1.8, a `String` in 1.9 - # @param count [Fixnum] The number of opening characters matched + # @param count [Integer] The number of opening characters matched # before calling this method # @return [(String, String)] The string matched within the balanced pair # and the rest of the string. diff --git a/lib/sass/source/map.rb b/lib/sass/source/map.rb index 14c6ad8..dc4c5dc 100644 --- a/lib/sass/source/map.rb +++ b/lib/sass/source/map.rb @@ -37,7 +37,7 @@ def add(input, output) # Shifts all output source ranges forward one or more lines. # - # @param delta [Fixnum] The number of lines to shift the ranges forward. + # @param delta [Integer] The number of lines to shift the ranges forward. def shift_output_lines(delta) return if delta == 0 @data.each do |m| @@ -49,7 +49,7 @@ def shift_output_lines(delta) # Shifts any output source ranges that lie on the first line forward one or # more characters on that line. # - # @param delta [Fixnum] The number of characters to shift the ranges + # @param delta [Integer] The number of characters to shift the ranges # forward. def shift_output_offsets(delta) return if delta == 0 diff --git a/lib/sass/source/position.rb b/lib/sass/source/position.rb index df39bd3..a62af45 100644 --- a/lib/sass/source/position.rb +++ b/lib/sass/source/position.rb @@ -2,17 +2,17 @@ module Sass::Source class Position # The one-based line of the document associated with the position. # - # @return [Fixnum] + # @return [Integer] attr_accessor :line # The one-based offset in the line of the document associated with the # position. # - # @return [Fixnum] + # @return [Integer] attr_accessor :offset - # @param line [Fixnum] The source line - # @param offset [Fixnum] The source offset + # @param line [Integer] The source line + # @param offset [Integer] The source offset def initialize(line, offset) @line = line @offset = offset diff --git a/lib/sass/tree/comment_node.rb b/lib/sass/tree/comment_node.rb index 8b7cdf0..1b73a15 100644 --- a/lib/sass/tree/comment_node.rb +++ b/lib/sass/tree/comment_node.rb @@ -59,7 +59,7 @@ def invisible? # Returns the number of lines in the comment. # - # @return [Fixnum] + # @return [Integer] def lines @value.inject(0) do |s, e| next s + e.count("\n") if e.is_a?(String) diff --git a/lib/sass/tree/node.rb b/lib/sass/tree/node.rb index 3d8c444..8703bc4 100644 --- a/lib/sass/tree/node.rb +++ b/lib/sass/tree/node.rb @@ -69,7 +69,7 @@ def invalid_parent_method_name # The line of the document on which this node appeared. # - # @return [Fixnum] + # @return [Integer] attr_accessor :line # The source range in the document on which this node appeared. diff --git a/lib/sass/tree/prop_node.rb b/lib/sass/tree/prop_node.rb index bef8c59..d26c824 100644 --- a/lib/sass/tree/prop_node.rb +++ b/lib/sass/tree/prop_node.rb @@ -39,7 +39,7 @@ class PropNode < Node # * This is a child property of another property # * The parent property has a value, and thus will be rendered # - # @return [Fixnum] + # @return [Integer] attr_accessor :tabs # The source range in which the property name appears. diff --git a/lib/sass/tree/rule_node.rb b/lib/sass/tree/rule_node.rb index 46bd8ac..dabf772 100644 --- a/lib/sass/tree/rule_node.rb +++ b/lib/sass/tree/rule_node.rb @@ -40,7 +40,7 @@ class RuleNode < Node # * This is a child rule of another rule # * The parent rule has properties, and thus will be rendered # - # @return [Fixnum] + # @return [Integer] attr_accessor :tabs # The entire selector source range for this rule. diff --git a/lib/sass/util.rb b/lib/sass/util.rb index 0a80fc7..e67500f 100644 --- a/lib/sass/util.rb +++ b/lib/sass/util.rb @@ -418,7 +418,7 @@ def subsequence?(seq1, seq2) # Returns information about the caller of the previous method. # # @param entry [String] An entry in the `#caller` list, or a similarly formatted string - # @return [[String, Fixnum, (String, nil)]] + # @return [[String, Integer, (String, nil)]] # An array containing the filename, line, and method name of the caller. # The method name may be nil def caller_info(entry = nil) @@ -636,7 +636,7 @@ def jruby? # Returns an array of ints representing the JRuby version number. # - # @return [Array] + # @return [Array] def jruby_version @jruby_version ||= ::JRUBY_VERSION.split(".").map {|s| s.to_i} end @@ -941,7 +941,7 @@ def enum_with_index(enum) # A version of `Enumerable#enum_cons` that works in Ruby 1.8 and 1.9. # # @param enum [Enumerable] The enumerable to get the enumerator for - # @param n [Fixnum] The size of each cons + # @param n [Integer] The size of each cons # @return [Enumerator] The consed enumerator def enum_cons(enum, n) ruby1_8? ? enum.enum_cons(n) : enum.each_cons(n) @@ -950,7 +950,7 @@ def enum_cons(enum, n) # A version of `Enumerable#enum_slice` that works in Ruby 1.8 and 1.9. # # @param enum [Enumerable] The enumerable to get the enumerator for - # @param n [Fixnum] The size of each slice + # @param n [Integer] The size of each slice # @return [Enumerator] The consed enumerator def enum_slice(enum, n) ruby1_8? ? enum.enum_slice(n) : enum.each_slice(n) @@ -977,7 +977,7 @@ def extract!(array) # Returns the ASCII code of the given character. # # @param c [String] All characters but the first are ignored. - # @return [Fixnum] The ASCII code of `c`. + # @return [Integer] The ASCII code of `c`. def ord(c) ruby1_8? ? c[0] : c.ord end @@ -1102,11 +1102,11 @@ def json_escape_string(s) # Converts the argument into a valid JSON value. # - # @param v [Fixnum, String, Array, Boolean, nil] + # @param v [Integer, String, Array, Boolean, nil] # @return [String] def json_value_of(v) case v - when Fixnum + when Integer v.to_s when String "\"" + json_escape_string(v) + "\"" @@ -1139,7 +1139,7 @@ def json_value_of(v) # Encodes `value` as VLQ (http://en.wikipedia.org/wiki/VLQ). # - # @param value [Fixnum] + # @param value [Integer] # @return [String] The encoded value def encode_vlq(value) if value < 0 diff --git a/lib/sass/version.rb b/lib/sass/version.rb index 89c8a06..3aa0064 100644 --- a/lib/sass/version.rb +++ b/lib/sass/version.rb @@ -8,7 +8,7 @@ module Sass # if it was installed from Git. module Version # Returns a hash representing the version of Sass. - # The `:major`, `:minor`, and `:teeny` keys have their respective numbers as Fixnums. + # The `:major`, `:minor`, and `:teeny` keys have their respective numbers as Integers. # The `:name` key has the name of the version. # The `:string` key contains a human-readable string representation of the version. # The `:number` key is the major, minor, and teeny keys separated by periods. @@ -41,7 +41,7 @@ module Version # :prerelease_number => 1 # } # - # @return [{Symbol => String/Fixnum}] The version hash + # @return [{Symbol => String/Integer}] The version hash # @comment # rubocop:disable ClassVars def version