class Sass::Script::Value::DeprecatedFalse

A SassScript object representing a `false` value that came from a call to `index()`. It will print deprecation warnings if it's used with `==`.

Public Class Methods

new(environment) click to toggle source
# File lib/sass/script/value/deprecated_false.rb, line 5
def self.new(environment)
  obj = allocate
  obj.send(:initialize, environment)
  obj
end
new(environment) click to toggle source
# File lib/sass/script/value/deprecated_false.rb, line 11
def initialize(environment)
  @value = false
  @global_env = environment.global_env
  if (frame = environment.stack.frames.last)
    @filename = frame.filename
    @line = frame.line
  end
end

Public Instance Methods

eq(other) click to toggle source
# File lib/sass/script/value/deprecated_false.rb, line 20
    def eq(other)
      if other.value == false && !warned?
        self.warned = true
        Sass::Util.sass_warn "DEPRECATION WARNING: The return value of index() will change from "false" to
"null" in future versions of Sass. For compatibility, avoid using "== false" on
the return value. For example, instead of "@if index(...) == false", just write
"@if not index(...)".
" + @global_env.stack.to_s.gsub(/^/, '        ')
      end
      Bool.new(other.value == false)
    end
neq(other) click to toggle source
# File lib/sass/script/value/deprecated_false.rb, line 33
    def neq(other)
      if other.value.nil? && !warned?
        self.warned = true
        Sass::Util.sass_warn "DEPRECATION WARNING: The return value of index() will change from "false" to
"null" in future versions of Sass. For compatibility, avoid using "!= null" on
the return value.
" + @global_env.stack.to_s.gsub(/^/, '        ')
      end
      Bool.new(other.value != false)
    end

Private Instance Methods

warned=(value) click to toggle source
# File lib/sass/script/value/deprecated_false.rb, line 51
def warned=(value)
  @global_env.deprecated_false_warning_given << [@filename, @line]
end
warned?() click to toggle source
# File lib/sass/script/value/deprecated_false.rb, line 47
def warned?
  @global_env.deprecated_false_warning_given.include?([@filename, @line])
end