Module: Metro::Views::Parsers

Extended by:
Parsers
Included in:
Parsers
Defined in:
lib/metro/views/parsers.rb

Instance Method Summary collapse

Instance Method Details

#parsersArray<Parsers>

Returns an array of all the registered view parsers. The last parser is the NoView parser.

Returns:

  • (Array<Parsers>)

    an array of all the registered view parsers. The last parser is the NoView parser.



27
28
29
# File 'lib/metro/views/parsers.rb', line 27

def parsers
  @parsers ||= []
end

#parsers_with_no_view_fallbackObject



31
32
33
# File 'lib/metro/views/parsers.rb', line 31

def parsers_with_no_view_fallback
  parsers + [ NoView ]
end

#register(parser) ⇒ Object

Register a view parser.

A parser is any class or instance that responds to #exists?(view_path), #parse(view_path) and #format.

Parameters:

  • parser (Parser)

    the parser to add to the list of available parsers.



19
20
21
# File 'lib/metro/views/parsers.rb', line 19

def register(parser)
  parsers.push parser
end