Sha256: 2948c4fa14cf71aeaf0db72ab12d8840d10c5d59688fd14d399261a0f451188a

Contents?: true

Size: 430 Bytes

Versions: 2

Compression:

Stored size: 430 Bytes

Contents

module Crumbs
  module Dsl
    class Controller

      def initialize(prefix, &block)
        @prefix = prefix
        instance_eval &block
      end

      def crumb(action, name=nil, &block)
        Crumbs.definitions.add "#{@prefix}##{action}", (block_given? ? block : name)
      end

      def t(key)
        if key.starts_with?('.')
          key.prepend 'crumbs'
        end
        I18n.t key
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crumbs-4.0.0.1 lib/crumbs/dsl/controller.rb
crumbs-4.0.0.0 lib/crumbs/dsl/controller.rb