Class: Twig::TokenParser::Cache

Inherits:
Base
  • Object
show all
Includes:
ExpressionParser::ParsesArguments
Defined in:
lib/twig/token_parser/cache.rb

Instance Attribute Summary

Attributes inherited from Base

#parser

Instance Method Summary collapse

Instance Method Details

#parse(token) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/twig/token_parser/cache.rb', line 8

def parse(token)
  stream = parser.stream
  lineno = token.lineno
  arguments = parse_named_arguments(parser)

  stream.expect(Token::BLOCK_END_TYPE)
  body = parser.subparse(method(:decide_cache_end), drop_needle: true)
  stream.expect(Token::BLOCK_END_TYPE)

  Node::Cache.new(arguments, body, lineno)
end

#tagObject



20
21
22
# File 'lib/twig/token_parser/cache.rb', line 20

def tag
  'cache'
end