Sha256: 957a780b4f8c5131f07eac1f46ddfd6aeb40e52143ee122dcc99cde7e6b35953

Contents?: true

Size: 585 Bytes

Versions: 2

Compression:

Stored size: 585 Bytes

Contents

module Bread
  module Controller
    extend ActiveSupport::Concern

    module ClassMethods
      attr_reader :bread_block
      def bread(&block)
        @bread_block = block
        before_filter :execute_bread_command
      end
    end

    attr_accessor :_bread_trees

    def _bread_trees
      @_bread_trees ||= {}
    end

    def execute_bread_command
      Command.new(self).instance_eval(&self.class.bread_block)
    end

  end
end

if defined? ActionController::Base
  ActionController::Base.class_eval do
    include Bread::Controller
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bread-0.0.3 lib/bread/controller.rb
bread-0.0.2 lib/bread/controller.rb