class MotionHTMLPipeline::Pipeline::BodyContent

Public: Runs a String of content through an HTML processing pipeline, providing easy access to a generated DocumentFragment.

Attributes

result[R]

Public Class Methods

new(body, context, pipeline) click to toggle source

Public: Initialize a BodyContent.

body - A String body. context - A Hash of context options for the filters. pipeline - A MotionHTMLPipeline::Pipeline object with one or more Filters.

# File lib/motion-html-pipeline/pipeline/body_content.rb, line 15
def initialize(body, context, pipeline)
  @body = body
  @context = context
  @pipeline = pipeline
end

Public Instance Methods

document() click to toggle source

Public: Parses the output into a DocumentFragment.

Returns a DocumentFragment.

# File lib/motion-html-pipeline/pipeline/body_content.rb, line 39
def document
  @document ||= MotionHTMLPipeline::Pipeline.parse output
end
output() click to toggle source

Public: Gets the updated body from the Pipeline result.

Returns a String or DocumentFragment.

# File lib/motion-html-pipeline/pipeline/body_content.rb, line 32
def output
  @output ||= result[:output]
end