Sha256: b4c8ea8700dc922890281c93060aba74af6c9c35ff4098a95aafc48c97c43357

Contents?: true

Size: 479 Bytes

Versions: 2

Compression:

Stored size: 479 Bytes

Contents

module Crumbs
  module DSL
    class Controller

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

      def action(action, name=nil, &block)
        Crumbs.add(
          @controller.to_s,
          action.to_s,
          (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-2.1.2 lib/crumbs/dsl/controller.rb
crumbs-2.1.1 lib/crumbs/dsl/controller.rb