Sha256: adb3e349ca6e49281a1c450be484d9348064978449699d44b6f23c001a63685d

Contents?: true

Size: 362 Bytes

Versions: 4

Compression:

Stored size: 362 Bytes

Contents

module Crumbs
  class Definitions

    def find(id, params)
      if registry.has_key?(id)
        name = registry[id]
        if name.is_a?(Proc)
          name.call params
        else
          name
        end
      end
    end

    def add(id, name)
      registry[id] = name
    end

    private

    def registry
      @registry ||= {}
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
crumbs-5.1.1 lib/crumbs/definitions.rb
crumbs-5.1.0 lib/crumbs/definitions.rb
crumbs-4.0.0.1 lib/crumbs/definitions.rb
crumbs-4.0.0.0 lib/crumbs/definitions.rb