Class: Sass::Value::Boolean

Inherits:
Object
  • Object
show all
Includes:
Sass::Value
Defined in:
lib/sass/value/boolean.rb

Overview

Sass’s boolean type.

Constant Summary collapse

TRUE =

Sass’s true value.

Boolean.new(true)
FALSE =

Sass’s false value.

Boolean.new(false)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Sass::Value

#[], #assert_calculation, #assert_calculation_value, #assert_color, #assert_function, #assert_map, #assert_mixin, #assert_number, #assert_string, #at, #bracketed?, #eql?, #sass_index_to_array_index, #separator, #to_a, #to_map, #to_nil

Constructor Details

#initialize(value) ⇒ Boolean

Returns a new instance of Boolean.

Parameters:

  • value (::Boolean)


12
13
14
# File 'lib/sass/value/boolean.rb', line 12

def initialize(value)
  @value = value
end

Instance Attribute Details

#value::Boolean (readonly) Also known as: to_bool

Returns:

  • (::Boolean)


17
18
19
# File 'lib/sass/value/boolean.rb', line 17

def value
  @value
end

Class Method Details

.new(value) ⇒ Object



47
48
49
# File 'lib/sass/value/boolean.rb', line 47

def self.new(value)
  value ? Boolean::TRUE : Boolean::FALSE
end

Instance Method Details

#!Boolean

Returns:



20
21
22
# File 'lib/sass/value/boolean.rb', line 20

def !
  value ? Boolean::FALSE : Boolean::TRUE
end

#==(other) ⇒ ::Boolean

Returns:

  • (::Boolean)


25
26
27
# File 'lib/sass/value/boolean.rb', line 25

def ==(other)
  other.is_a?(Sass::Value::Boolean) && other.value == value
end

#assert_boolean(_name = nil) ⇒ Boolean

Returns:



37
38
39
# File 'lib/sass/value/boolean.rb', line 37

def assert_boolean(_name = nil)
  self
end

#hashInteger

Returns:

  • (Integer)


30
31
32
# File 'lib/sass/value/boolean.rb', line 30

def hash
  @hash ||= value.hash
end