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:



211
212
213
214
# File 'lib/mbrao/parser.rb', line 211

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.



222
223
224
225
# File 'lib/mbrao/parser.rb', line 222

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