Sha256: edc6df23dc9abd93dd50e54cbedcbdc4344cec57fa3dee2ba38d250139add430

Contents?: true

Size: 809 Bytes

Versions: 75

Compression:

Stored size: 809 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] ||= "saucy"
        end
      end
    end
  end
end

Version data entries

75 entries across 75 versions & 2 rubygems

Version Path
saucy-0.4.8 lib/saucy/layouts.rb
saucy-0.4.7 lib/saucy/layouts.rb
saucy-0.4.6 lib/saucy/layouts.rb
saucy-0.4.5 lib/saucy/layouts.rb
saucy-0.4.4 lib/saucy/layouts.rb
saucy-0.4.3 lib/saucy/layouts.rb
saucy-0.4.2 lib/saucy/layouts.rb
saucy-0.4.1 lib/saucy/layouts.rb
saucy-0.3.4.1 lib/saucy/layouts.rb
saucy-0.4.0 lib/saucy/layouts.rb
saucy-0.3.4 lib/saucy/layouts.rb
saucy-0.3.3 lib/saucy/layouts.rb
saucy-0.3.2 lib/saucy/layouts.rb
saucy-0.3.1 lib/saucy/layouts.rb
saucy-0.3.0 lib/saucy/layouts.rb