Class: CaptainHoog::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/captain_hoog/message.rb

Instance Method Summary collapse

Constructor Details

#initialize(color, body) ⇒ Message

Returns a new instance of Message.



4
5
6
7
# File 'lib/captain_hoog/message.rb', line 4

def initialize(color, body)
  @body  = body
  @color = color
end

Instance Method Details

#call(no_color: true) ⇒ Object



9
10
11
# File 'lib/captain_hoog/message.rb', line 9

def call(no_color: true)
  (no_color || will_have_no_color) ? message : message.send(@color)
end

#messageObject



13
14
15
16
17
# File 'lib/captain_hoog/message.rb', line 13

def message
  message = @body.call
  check_msg(message)
  message
end