Sha256: 27e90977a55b43b64ec45bfc4b7fc7d295bbdfee8ad2625f2753e60fb6377c42

Contents?: true

Size: 941 Bytes

Versions: 93

Compression:

Stored size: 941 Bytes

Contents

# frozen_string_literal: true

# A SassScript object representing a boolean (true or false) value.

class SassC::Script::Value::Bool < SassC::Script::Value

  # The true value in SassScript.
  # This is assigned before new is overridden below so that we use the default implementation.
  TRUE = new(true)

  # The false value in SassScript.
  # This is assigned before new is overridden below so that we use the default implementation.
  FALSE = new(false)

  # We override object creation so that users of the core API
  # will not need to know that booleans are specific constants.
  # Tests `value` for truthiness and returns the TRUE or FALSE constant.
  def self.new(value)
    value ? TRUE : FALSE
  end

  # The pure Ruby value of this Boolean
  attr_reader :value
  alias_method :to_bool, :value

  # Returns the string "true" or "false" for this value
  def to_s(opts = {})
    @value.to_s
  end
  alias_method :to_sass, :to_s

end

Version data entries

93 entries across 77 versions & 7 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/sassc-2.4.0/lib/sassc/script/value/bool.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/sassc-2.4.0/lib/sassc/script/value/bool.rb
sassc-embedded-1.80.2 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.80.1 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.80.0 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.79.0 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.78.0 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/sassc-2.4.0/lib/sassc/script/value/bool.rb
sassc-embedded-1.77.8 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.77.7 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.77.6 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.77.5 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.77.4 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.77.3 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.77.2 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.77.1 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.77.0 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.76.0 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.75.2 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.75.1 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb