Sha256: a22df427f0eca81ad0aeaa94ac1caf038ed90685dd385b8d4b42a86b3c04a87e

Contents?: true

Size: 825 Bytes

Versions: 47

Compression:

Stored size: 825 Bytes

Contents

module Saucy
  class Layouts
    def initialize
      @controllers = {}
    end

    def method_missing(controller_name, *args, &block)
      @controllers[controller_name.to_s] ||= Controller.new
    end

    def self.to_proc
      lambda do |controller|
        controller_name = controller.controller_name
        action_name = controller.action_name
        Rails.application.config.saucy.layouts.send(controller_name).send(action_name)
      end
    end

    private

    class Controller
      def initialize
        @actions = {}
      end

      def method_missing(method_name, *args, &block)
        action_name = method_name.to_s
        if action_name.sub!(/=$/, '')
          @actions[action_name] = args.first
        else
          @actions[action_name] ||= "application"
        end
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
saucy-0.2.7 lib/saucy/layouts.rb
saucy-0.2.6.1 lib/saucy/layouts.rb
saucy-0.2.6 lib/saucy/layouts.rb
saucy-0.2.5 lib/saucy/layouts.rb
saucy-0.2.4.1 lib/saucy/layouts.rb
saucy-0.2.4 lib/saucy/layouts.rb
saucy-0.2.3 lib/saucy/layouts.rb
saucy-0.2.2 lib/saucy/layouts.rb
saucy-0.2.1 lib/saucy/layouts.rb
saucy-0.2.0 lib/saucy/layouts.rb
saucy-0.1.18 lib/saucy/layouts.rb
saucy-0.1.17 lib/saucy/layouts.rb
saucy-0.1.16 lib/saucy/layouts.rb
saucy-0.1.15 lib/saucy/layouts.rb
saucy-0.1.14 lib/saucy/layouts.rb
saucy-0.1.13 lib/saucy/layouts.rb
saucy-0.1.12 lib/saucy/layouts.rb
saucy-0.1.11 lib/saucy/layouts.rb
saucy-0.1.9 lib/saucy/layouts.rb
saucy-0.1.8 lib/saucy/layouts.rb