Class: Paltrow::Message

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/paltrow/message.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.alert(an_alert) ⇒ Object



26
27
28
# File 'lib/paltrow/message.rb', line 26

def self.alert an_alert
  new(text: an_alert, success: false)
end

.notice(a_notice) ⇒ Object



22
23
24
# File 'lib/paltrow/message.rb', line 22

def self.notice a_notice
  new(text: a_notice, success: true)
end

Instance Method Details

#alertObject



18
19
20
# File 'lib/paltrow/message.rb', line 18

def alert
  failure? ? text : ""
end

#failure?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/paltrow/message.rb', line 10

def failure?
  !success?
end

#noticeObject



14
15
16
# File 'lib/paltrow/message.rb', line 14

def notice
  success? ? text : ""
end

#success?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/paltrow/message.rb', line 6

def success?
  success
end