Class: FlowChat::Messenger::Renderer
- Inherits:
-
Object
- Object
- FlowChat::Messenger::Renderer
- Includes:
- Renderers::MarkdownSupport
- Defined in:
- lib/flow_chat/messenger/renderer.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#choices ⇒ Object
readonly
Returns the value of attribute choices.
-
#media ⇒ Object
readonly
Returns the value of attribute media.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(message, choices: nil, media: nil) ⇒ Renderer
constructor
A new instance of Renderer.
- #render ⇒ Object
Methods included from Renderers::MarkdownSupport
included, #sanitize_html, #to_html, #to_plain_text
Constructor Details
#initialize(message, choices: nil, media: nil) ⇒ Renderer
Returns a new instance of Renderer.
10 11 12 13 14 |
# File 'lib/flow_chat/messenger/renderer.rb', line 10 def initialize(, choices: nil, media: nil) @message = @choices = choices @media = media end |
Instance Attribute Details
#choices ⇒ Object (readonly)
Returns the value of attribute choices.
8 9 10 |
# File 'lib/flow_chat/messenger/renderer.rb', line 8 def choices @choices end |
#media ⇒ Object (readonly)
Returns the value of attribute media.
8 9 10 |
# File 'lib/flow_chat/messenger/renderer.rb', line 8 def media @media end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
8 9 10 |
# File 'lib/flow_chat/messenger/renderer.rb', line 8 def @message end |
Instance Method Details
#render ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/flow_chat/messenger/renderer.rb', line 16 def render return if media && choices.blank? result = case FlowChat::Meta::ChoiceLadder.rung_for(choice_count, limits) when :none then build_text when :quick_replies then build_quick_replies when :carousel then build_carousel when :numbered then build_text end attach_media(result) end |