Sha256: 1471a2d50acfb74dfc8485da5165af5f2789dae4d7df4060fedd212c1e632998

Contents?: true

Size: 547 Bytes

Versions: 1

Compression:

Stored size: 547 Bytes

Contents

module Crumbs
  class Definitions
    class << self

      def all
        @all ||= {}
      end

      def add(controller, action, name)
        if all.has_key? controller
          all[controller][action] = name
        else
          all[controller] = { action => name }
        end
      end

      def find(controller, action, params)
        if all.has_key? controller and all[controller].has_key? action
          name = all[controller][action]
          name.is_a?(Proc) ? name.call(params) : name
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
crumbs-1.2.0 lib/crumbs/definitions.rb