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.
10
11
12
|
# File 'lib/sass/script/literal.rb', line 10
def initialize(value = nil)
@value = value
end
|
Instance Attribute Details
Returns the value of attribute value.
8
9
10
|
# File 'lib/sass/script/literal.rb', line 8
def value
@value
end
|
Instance Method Details
#==(other) ⇒ Object
74
75
76
|
# File 'lib/sass/script/literal.rb', line 74
def ==(other)
eq(other).to_bool
end
|
#and(other) ⇒ Object
18
19
20
|
# File 'lib/sass/script/literal.rb', line 18
def and(other)
to_bool ? other : self
end
|
#comma(other) ⇒ Object
42
43
44
|
# File 'lib/sass/script/literal.rb', line 42
def comma(other)
Sass::Script::String.new("#{self.to_s}, #{other.to_s}")
end
|
#concat(other) ⇒ Object
38
39
40
|
# File 'lib/sass/script/literal.rb', line 38
def concat(other)
Sass::Script::String.new("#{self.to_s} #{other.to_s}")
end
|
#div(other) ⇒ Object
54
55
56
|
# File 'lib/sass/script/literal.rb', line 54
def div(other)
Sass::Script::String.new("#{self.to_s}/#{other.to_s}")
end
|
#eq(other) ⇒ Object
26
27
28
|
# File 'lib/sass/script/literal.rb', line 26
def eq(other)
Sass::Script::Bool.new(self.class == other.class && self.value == other.value)
end
|
66
67
68
|
# File 'lib/sass/script/literal.rb', line 66
def inspect
value.inspect
end
|
#minus(other) ⇒ Object
50
51
52
|
# File 'lib/sass/script/literal.rb', line 50
def minus(other)
Sass::Script::String.new("#{self.to_s}-#{other.to_s}")
end
|
#neq(other) ⇒ Object
30
31
32
|
# File 'lib/sass/script/literal.rb', line 30
def neq(other)
Sass::Script::Bool.new(!eq(other).to_bool)
end
|
#or(other) ⇒ Object
22
23
24
|
# File 'lib/sass/script/literal.rb', line 22
def or(other)
to_bool ? self : other
end
|
14
15
16
|
# File 'lib/sass/script/literal.rb', line 14
def perform(environment)
self
end
|
#plus(other) ⇒ Object
46
47
48
|
# File 'lib/sass/script/literal.rb', line 46
def plus(other)
Sass::Script::String.new(self.to_s + other.to_s)
end
|
70
71
72
|
# File 'lib/sass/script/literal.rb', line 70
def to_bool
true
end
|
78
79
80
|
# File 'lib/sass/script/literal.rb', line 78
def to_i
raise Sass::SyntaxError.new("#{self.inspect} is not an integer.")
end
|
#unary_div ⇒ Object
62
63
64
|
# File 'lib/sass/script/literal.rb', line 62
def unary_div
Sass::Script::String.new("/#{self.to_s}")
end
|
#unary_minus ⇒ Object
58
59
60
|
# File 'lib/sass/script/literal.rb', line 58
def unary_minus
Sass::Script::String.new("-#{self.to_s}")
end
|
#unary_not ⇒ Object
34
35
36
|
# File 'lib/sass/script/literal.rb', line 34
def unary_not
Sass::Script::Bool.new(!to_bool)
end
|