Class: Campo::Plugins::Partial::Klass

Inherits:
Campo::Plugins::Plugin show all
Defined in:
lib/campo/plugins/partial.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{partial: false}

Instance Method Summary collapse

Methods inherited from Campo::Plugins::Plugin

#afters, #befores

Methods included from Campo::Plugins::Pluggable

#after_output, #before_output, #extras, #on_plugin, #plugged_in

Constructor Details

#initialize(opts = {}) ⇒ Klass

Returns a new instance of Klass.



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/campo/plugins/partial.rb', line 31

def initialize( opts={} )
  after_output do |output,options|
    options[:partial] ? 
      output : # partial
      declarations + output # whole form
  end
  on_plugin do
    Campo::Outputter.send(:include, Campo::Plugins::Partial::InstanceMethods)
    Campo::Outputter::DEFAULT_OPTIONS.merge!({partial: false})
  end
end