Class: Curlybars::Node::Partial

Inherits:
Struct
  • Object
show all
Defined in:
lib/curlybars/node/partial.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



3
4
5
# File 'lib/curlybars/node/partial.rb', line 3

def path
  @path
end

Instance Method Details

#cache_keyObject



16
17
18
19
20
21
# File 'lib/curlybars/node/partial.rb', line 16

def cache_key
  [
    path.cache_key,
    self.class.name
  ].join("/")
end

#compileObject



4
5
6
7
8
9
10
# File 'lib/curlybars/node/partial.rb', line 4

def compile
  # NOTE: the following is a heredoc string, representing the ruby code fragment
  # outputted by this node.
  <<-RUBY
    buffer.concat(rendering.cached_call(#{path.compile}).to_s)
  RUBY
end

#validate(branches) ⇒ Object



12
13
14
# File 'lib/curlybars/node/partial.rb', line 12

def validate(branches)
  path.validate(branches, check_type: :partial)
end