Class: Middleman::Diff::Extension

Inherits:
Extension
  • Object
show all
Defined in:
lib/middleman-diff/extension.rb

Overview

Middleman extension

Instance Method Summary collapse

Constructor Details

#initialize(app, **options_hash, &block) ⇒ void

Runs when the extension is activated

Parameters:

  • app (Middleman::Application)

    Middleman application instance

  • options_hash (Hash)

    options

  • block (Block)

    configuration block



20
21
22
23
24
25
26
# File 'lib/middleman-diff/extension.rb', line 20

def initialize(app, **options_hash, &block)
  # Build options from options_hash
  super

  require 'middleman-diff/preview'
  require 'pathname'
end

Instance Method Details

#with_preview {|Middleman::Diff::Preview| ... } ⇒ void

This method returns an undefined value.

Yield a preview of the build.

Yields:

Yield Returns:

  • (void)


33
34
35
36
37
38
39
40
# File 'lib/middleman-diff/extension.rb', line 33

def with_preview
  preview = Preview.new(app, build_hooks: options.build_hooks,
                             temp_dir: options.temp_dir)

  yield preview

  preview.dispose
end