Class: FlowChat::Intercom::Renderer

Inherits:
Object
  • Object
show all
Includes:
Renderers::MarkdownSupport
Defined in:
lib/flow_chat/intercom/renderer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Renderers::MarkdownSupport

included, #sanitize_html, #to_html

Constructor Details

#initialize(message, choices: nil, media: nil) ⇒ Renderer

Returns a new instance of Renderer.



10
11
12
13
14
# File 'lib/flow_chat/intercom/renderer.rb', line 10

def initialize(message, choices: nil, media: nil)
  @message = message
  @choices = choices
  @media = media
end

Instance Attribute Details

#choicesObject (readonly)

Returns the value of attribute choices.



8
9
10
# File 'lib/flow_chat/intercom/renderer.rb', line 8

def choices
  @choices
end

#mediaObject (readonly)

Returns the value of attribute media.



8
9
10
# File 'lib/flow_chat/intercom/renderer.rb', line 8

def media
  @media
end

#messageObject (readonly)

Returns the value of attribute message.



8
9
10
# File 'lib/flow_chat/intercom/renderer.rb', line 8

def message
  @message
end

Instance Method Details

#renderObject



16
17
18
19
20
21
22
# File 'lib/flow_chat/intercom/renderer.rb', line 16

def render
  if choices
    build_selection_message
  else
    build_text_message
  end
end