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
sassc-embedded-1.75.0 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.74.1 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.74.0 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.70.1 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.70.0 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.69.1 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.69.0 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.68.6 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.68.5 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.68.4 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.68.3 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.68.2 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
sassc-embedded-1.68.1 vendor/github.com/sass/sassc-ruby/lib/sassc/script/value/bool.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/sassc-2.4.0/lib/sassc/script/value/bool.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/sassc-2.4.0/lib/sassc/script/value/bool.rb
sassc-2.4.0-x64-mingw32 lib/sassc/script/value/bool.rb
sassc-2.4.0 lib/sassc/script/value/bool.rb
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/sassc-2.0.0/lib/sassc/script/value/bool.rb
sassc-2.3.0-x64-mingw32 lib/sassc/script/value/bool.rb
sassc-2.3.0 lib/sassc/script/value/bool.rb