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.16.1 lib/saucy/layouts.rb
saucy-0.16.0 lib/saucy/layouts.rb
saucy-0.15.2 lib/saucy/layouts.rb
saucy-0.15.1 lib/saucy/layouts.rb
saucy-0.15.0 lib/saucy/layouts.rb
saucy-0.14.5 lib/saucy/layouts.rb
saucy-0.14.3 lib/saucy/layouts.rb
saucy-0.10.10 lib/saucy/layouts.rb
saucy-0.14.2 lib/saucy/layouts.rb
saucy-0.14.1 lib/saucy/layouts.rb
saucy-0.14.0 lib/saucy/layouts.rb
saucy-0.13.3 lib/saucy/layouts.rb
saucy-0.13.2 lib/saucy/layouts.rb
saucy-0.10.9 lib/saucy/layouts.rb
saucy-0.10.8 lib/saucy/layouts.rb
saucy-0.13.1 lib/saucy/layouts.rb
saucy-0.13.0 lib/saucy/layouts.rb
saucy-0.12.5 lib/saucy/layouts.rb
saucy-0.12.4 lib/saucy/layouts.rb
saucy-0.12.3 lib/saucy/layouts.rb