Class: Mbrao::Parser

Inherits:
Object
  • Object
show all
Includes:
PublicInterface, Validations
Defined in:
lib/mbrao/parser.rb

Overview

A parser to handle pipelined content.

Instance Method Summary (collapse)

Instance Method Details

- (Content) parse(content, options = {})

Parses a source text.

Parameters:

  • content (Object)

    The content to parse.

  • options (Hash) (defaults to: {})

    A list of options for parsing.

Returns:



233
234
235
236
# File 'lib/mbrao/parser.rb', line 233

def parse(content, options = {})
  options = sanitize_parsing_options(options)
  ::Mbrao::Parser.create_engine(options[:engine]).parse(content, options)
end

- (String) render(content, options = {}, context = {})

Renders a content.

Parameters:

  • content (Content)

    The content to parse.

  • options (Hash) (defaults to: {})

    A list of options for renderer.

  • context (Hash) (defaults to: {})

    A context for rendering.

Returns:

  • (String)

    The rendered content.



244
245
246
247
# File 'lib/mbrao/parser.rb', line 244

def render(content, options = {}, context = {})
  options = sanitize_rendering_options(options)
  ::Mbrao::Parser.create_engine(options[:engine], :rendering).render(content, options, context)
end