summaryrefslogtreecommitdiff
path: root/vendor/bundle/ruby/3.4.0/gems/sass-embedded-1.101.0-arm64-darwin/lib/sass/value/null.rb
blob: 57e239107a33da9e554581489a6bdc2b27895a06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# frozen_string_literal: true

module Sass
  module Value
    # Sass's null type.
    #
    # @see https://sass-lang.com/documentation/js-api/variables/sassnull/
    class Null
      include Value

      def initialize
        @value = nil
      end

      # @return [nil]
      attr_reader :value

      # @return [Boolean]
      def !
        Boolean::TRUE
      end

      # @return [::Boolean]
      def ==(other)
        other.is_a?(Sass::Value::Null)
      end

      # @return [Integer]
      def hash
        @hash ||= value.hash
      end

      # @return [::Boolean]
      def to_bool # rubocop:disable Naming/PredicateMethod
        false
      end

      alias to_nil value

      # Sass's null value.
      NULL = Null.new

      def self.new
        NULL
      end
    end
  end
end