Sha256: b9b92cc6ee51a6353f26529b8ecc329d14469fbdf2d9f3c68b90775a57deda9d

Contents?: true

Size: 598 Bytes

Versions: 2

Compression:

Stored size: 598 Bytes

Contents

# coding: UTF-8
module Rescue
  module Controller
    class Flash

      def self.message object, key 
        scope = [:views]
        scope += object.controller_path.split('/')
        scope << object.action_name
        scope << :flash
        text(key, scope)
      end

      def self.default key
        s = I18n.t(key, scope: [:default, :flash], default: '')
        s.blank? ? nil : s
      end

      def self.text key, scope = []
        s = I18n.t(key, scope: scope, default: '')
        s.blank? ? default(key) : s
      end
      private_class_method :default, :text
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rescue-dog-0.3.5 lib/rescue/controllers/flash.rb
rescue-dog-0.3.4 lib/rescue/controllers/flash.rb