Class: Cutaneous::Compiler::Text

Inherits:
Expression show all
Defined in:
lib/cutaneous/compiler/expression.rb

Instance Method Summary collapse

Methods inherited from Expression

#affect

Constructor Details

#initialize(expression, strip_whitespace = false) ⇒ Text

Returns a new instance of Text.



32
33
34
35
36
37
38
39
# File 'lib/cutaneous/compiler/expression.rb', line 32

def initialize(expression, strip_whitespace = false)
  @whitespace = ""
  if strip_whitespace && expression =~ BEGINNING_WHITESPACE
    @whitespace = $1
    expression.slice!(0, @whitespace.length)
  end
  super(expression)
end

Instance Method Details

#to_scriptObject



41
42
43
# File 'lib/cutaneous/compiler/expression.rb', line 41

def to_script
  %(__buf << %Q`) << @expression << %(` ; ) << @whitespace << ";"
end