Class: Sass::Script::Interpolation
- Inherits:
-
Node
show all
- Defined in:
- lib/sass/script/interpolation.rb
Instance Attribute Summary
Attributes inherited from Node
#context, #line, #options
Instance Method Summary
collapse
Methods inherited from Node
#dasherize, #perform
Constructor Details
#initialize(before, mid, after, wb, wa) ⇒ Interpolation
Returns a new instance of Interpolation.
3
4
5
6
7
8
9
|
# File 'lib/sass/script/interpolation.rb', line 3
def initialize(before, mid, after, wb, wa)
@before = before
@mid = mid
@after = after
@whitespace_before = wb
@whitespace_after = wa
end
|
Instance Method Details
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/sass/script/interpolation.rb', line 31
def _perform(environment)
res = ""
res << @before.perform(environment).to_s if @before
res << " " if @before && @whitespace_before
val = @mid.perform(environment)
res << (val.is_a?(Sass::Script::String) ? val.value : val.to_s)
res << " " if @after && @whitespace_after
res << @after.perform(environment).to_s if @after
Sass::Script::String.new(res)
end
|
#children
25
26
27
|
# File 'lib/sass/script/interpolation.rb', line 25
def children
[@before, @mid, @after].compact
end
|
#inspect
11
12
13
|
# File 'lib/sass/script/interpolation.rb', line 11
def inspect
"(interpolation #{@before.inspect} #{@mid.inspect} #{@after.inspect})"
end
|
#to_sass(opts = {})
15
16
17
18
19
20
21
22
23
|
# File 'lib/sass/script/interpolation.rb', line 15
def to_sass(opts = {})
res = ""
res << @before.to_sass(opts) if @before
res << ' ' if @before && @whitespace_before
res << '#{' << @mid.to_sass(opts) << '}'
res << ' ' if @after && @whitespace_after
res << @after.to_sass(opts) if @after
res
end
|