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.28.1 lib/saucy/layouts.rb
saucy-0.2.28 lib/saucy/layouts.rb
saucy-0.2.27 lib/saucy/layouts.rb
saucy-0.2.26 lib/saucy/layouts.rb
saucy-0.2.25 lib/saucy/layouts.rb
saucy-0.2.24 lib/saucy/layouts.rb
saucy-0.2.21 lib/saucy/layouts.rb
saucy-0.2.20 lib/saucy/layouts.rb
saucy-0.2.18 lib/saucy/layouts.rb
saucy-0.2.17 lib/saucy/layouts.rb
saucy-0.2.16 lib/saucy/layouts.rb
saucy-0.2.15 lib/saucy/layouts.rb
saucy-0.2.14 lib/saucy/layouts.rb
saucy-0.2.13 lib/saucy/layouts.rb
saucy-0.2.12 lib/saucy/layouts.rb
saucy-0.2.11 lib/saucy/layouts.rb
saucy-0.2.10 lib/saucy/layouts.rb
saucy-0.2.9 lib/saucy/layouts.rb
saucy-0.2.8.1 lib/saucy/layouts.rb
saucy-0.2.8 lib/saucy/layouts.rb