Class: Sass::Script::String

Inherits:
Literal show all
Defined in:
lib/sass/script/string.rb

Overview

:nodoc:

Constant Summary collapse

INTERPOLATION =
/(^|[^\\])\#\{([^}]*)\}/

Instance Attribute Summary

Attributes inherited from Literal

#value

Instance Method Summary collapse

Methods inherited from Literal

#==, #and, #comma, #concat, #eq, #initialize, #inspect, #neq, #or, #to_bool, #to_i, #unary_not

Constructor Details

This class inherits a constructor from Sass::Script::Literal

Instance Method Details

#div(other) ⇒ Object



26
27
28
# File 'lib/sass/script/string.rb', line 26

def div(other)
  Sass::Script::String.new("#{self.to_s}/#{other.to_s}")
end

#funcall(other) ⇒ Object



34
35
36
# File 'lib/sass/script/string.rb', line 34

def funcall(other)
  Sass::Script::String.new("#{self.to_s}(#{other.to_s})")
end

#minus(other) ⇒ Object



18
19
20
# File 'lib/sass/script/string.rb', line 18

def minus(other)
  Sass::Script::String.new("#{self.to_s}-#{other.to_s}")
end

#perform(environment) ⇒ Object

TODO pass line & char context to perform



7
8
9
10
11
12
# File 'lib/sass/script/string.rb', line 7

def perform(environment)
  interpolated = @value.gsub(INTERPOLATION) do |match|
    "#{$1}#{Sass::Script.resolve($2, 0, 0, environment)}"
  end
  Sass::Script::String.new(interpolated)
end

#plus(other) ⇒ Object



14
15
16
# File 'lib/sass/script/string.rb', line 14

def plus(other)
  Sass::Script::String.new(self.to_s + other.to_s)
end

#to_sObject



38
39
40
# File 'lib/sass/script/string.rb', line 38

def to_s
  @value
end

#unary_divObject



30
31
32
# File 'lib/sass/script/string.rb', line 30

def unary_div
  Sass::Script::String.new("/#{self.to_s}")
end

#unary_minusObject



22
23
24
# File 'lib/sass/script/string.rb', line 22

def unary_minus
  Sass::Script::String.new("-#{self.to_s}")
end