Class: Sablon::Statement::Insertion

Inherits:
Struct
  • Object
show all
Defined in:
lib/sablon/operations.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#exprObject

Returns the value of attribute expr

Returns:

  • (Object)

    the current value of expr



4
5
6
# File 'lib/sablon/operations.rb', line 4

def expr
  @expr
end

#fieldObject

Returns the value of attribute field

Returns:

  • (Object)

    the current value of field



4
5
6
# File 'lib/sablon/operations.rb', line 4

def field
  @field
end

Instance Method Details

#evaluate(env) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/sablon/operations.rb', line 5

def evaluate(env)
  if content = expr.evaluate(env.context)
    field.replace(Sablon::Content.wrap(content), env)
  else
    field.remove
  end
end