Sha256: 16d44f37f48f2fd91834ac96facdcf5529d6a85acc37cc63766833480cc6a37e

Contents?: true

Size: 976 Bytes

Versions: 2

Compression:

Stored size: 976 Bytes

Contents

require "action_view"
require "action_controller"
require "call_with_params"

module Blocks
  autoload :Base,          "blocks/base"
  autoload :Container,     "blocks/container"
  autoload :ViewAdditions, "blocks/view_additions"
  autoload :ControllerAdditions, "blocks/controller_additions"

  mattr_accessor :template_folder
  @@template_folder = "blocks"

  mattr_accessor :use_partials
  @@use_partials = false

  mattr_accessor :surrounding_tag_surrounds_before_and_after_blocks
  @@surrounding_tag_surrounds_before_and_after_blocks = false

  # Shortcut for using the templating feature / rendering templates
  def self.render_template(view, partial, options={}, &block)
    Blocks::Base.new(view, options).render_template(partial, &block)
  end

  # Default way to setup Blocks
  def self.setup
    yield self
  end
end

ActionView::Base.send :include, Blocks::ViewAdditions::ClassMethods
ActionController::Base.send :include, Blocks::ControllerAdditions::ClassMethods

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blocks-2.4.0 lib/blocks.rb
blocks-2.3.1 lib/blocks.rb