Class: Booth::Userland::ExtractFlashMessages
- Inherits:
-
Object
- Object
- Booth::Userland::ExtractFlashMessages
- Includes:
- Logging, MethodObject
- Defined in:
- lib/booth/userland/extract_flash_messages.rb
Instance Method Summary collapse
Methods included from MethodObject
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/booth/userland/extract_flash_messages.rb', line 10 def call check_arguments! return unless from.respond_to?(:public_message) return if from..blank? if from.success? debug { "Saving flash notice: #{from.}" } to[:notice] = from. else debug { "Saving flash alert: #{from.}" } to[:alert] = from. end nil end |
#check_arguments! ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/booth/userland/extract_flash_messages.rb', line 26 def check_arguments! raise(ArgumentError, 'You can only extract flash messages from something that is not nil') if from.nil? return if to.respond_to?(:notice=) raise ArgumentError, "Please pass in `to: flash` for public flash messages not #{to.inspect}" end |