Class: Template::Node::Part

Inherits:
Template::Node show all
Defined in:
lib/template/node/part.rb

Instance Method Summary collapse

Constructor Details

#initialize(part) ⇒ Part

Returns a new instance of Part.



4
5
6
7
8
9
10
11
12
# File 'lib/template/node/part.rb', line 4

def initialize(part)
  if part.key?(:text)
    @part = ::Template::Node::TextPart.new(part[:text])
  elsif part.key?(:code)
    @part = ::Template::Node::CodePart.new(part[:code])
  else
    raise NotImplementedError.new(part.inspect)
  end
end

Instance Method Details

#evaluate(**args) ⇒ Object



14
15
16
# File 'lib/template/node/part.rb', line 14

def evaluate(**args)
  @part.evaluate(**args)
end