Sha256: c79698a2124ee740c2573df1e1b1f7cf198594795a99544dacaf45c3c8117bb8

Contents?: true

Size: 431 Bytes

Versions: 2

Compression:

Stored size: 431 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-5.1.1 lib/crumbs/dsl/controller.rb
crumbs-5.1.0 lib/crumbs/dsl/controller.rb