Sha256: bc3f4b2e35495d75cf735d811b3a806523ae9bd05ed6686d780ec47d4dd8d004

Contents?: true

Size: 815 Bytes

Versions: 16

Compression:

Stored size: 815 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
        Saucy::Configuration.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

16 entries across 16 versions & 1 rubygems

Version Path
saucy-0.2.45 lib/saucy/layouts.rb
saucy-0.2.44 lib/saucy/layouts.rb
saucy-0.2.43 lib/saucy/layouts.rb
saucy-0.2.42 lib/saucy/layouts.rb
saucy-0.2.41 lib/saucy/layouts.rb
saucy-0.2.40 lib/saucy/layouts.rb
saucy-0.2.39 lib/saucy/layouts.rb
saucy-0.2.38 lib/saucy/layouts.rb
saucy-0.2.36 lib/saucy/layouts.rb
saucy-0.2.35 lib/saucy/layouts.rb
saucy-0.2.34 lib/saucy/layouts.rb
saucy-0.2.33 lib/saucy/layouts.rb
saucy-0.2.32 lib/saucy/layouts.rb
saucy-0.2.31 lib/saucy/layouts.rb
saucy-0.2.30 lib/saucy/layouts.rb
saucy-0.2.29 lib/saucy/layouts.rb