Class: Sass::Script::Literal
Overview
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(value = nil) ⇒ Literal
Returns a new instance of Literal.
9
10
11
|
# File 'lib/sass/script/literal.rb', line 9
def initialize(value = nil)
@value = value
end
|
Instance Attribute Details
Returns the value of attribute value.
7
8
9
|
# File 'lib/sass/script/literal.rb', line 7
def value
@value
end
|
Instance Method Details
#==(other) ⇒ Object
53
54
55
|
# File 'lib/sass/script/literal.rb', line 53
def ==(other)
eq(other).to_bool
end
|
#and(other) ⇒ Object
17
18
19
|
# File 'lib/sass/script/literal.rb', line 17
def and(other)
to_bool ? other : self
end
|
#comma(other) ⇒ Object
41
42
43
|
# File 'lib/sass/script/literal.rb', line 41
def comma(other)
Sass::Script::String.new("#{self.to_s}, #{other.to_s}")
end
|
#concat(other) ⇒ Object
37
38
39
|
# File 'lib/sass/script/literal.rb', line 37
def concat(other)
Sass::Script::String.new("#{self.to_s} #{other.to_s}")
end
|
#eq(other) ⇒ Object
25
26
27
|
# File 'lib/sass/script/literal.rb', line 25
def eq(other)
Sass::Script::Bool.new(self.class == other.class && self.value == other.value)
end
|
45
46
47
|
# File 'lib/sass/script/literal.rb', line 45
def inspect
value.inspect
end
|
#neq(other) ⇒ Object
29
30
31
|
# File 'lib/sass/script/literal.rb', line 29
def neq(other)
Sass::Script::Bool.new(!eq(other).to_bool)
end
|
#or(other) ⇒ Object
21
22
23
|
# File 'lib/sass/script/literal.rb', line 21
def or(other)
to_bool ? self : other
end
|
13
14
15
|
# File 'lib/sass/script/literal.rb', line 13
def perform(environment)
self
end
|
49
50
51
|
# File 'lib/sass/script/literal.rb', line 49
def to_bool
true
end
|
57
58
59
|
# File 'lib/sass/script/literal.rb', line 57
def to_i
raise Sass::SyntaxError.new("#{self.inspect} is not an integer.")
end
|
#unary_not ⇒ Object
33
34
35
|
# File 'lib/sass/script/literal.rb', line 33
def unary_not
Sass::Script::Bool.new(!to_bool)
end
|