Class: SimpleFormMarkdownEditor::Renderer

Inherits:
Struct
  • Object
show all
Defined in:
lib/simple_form_markdown_editor/renderer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str, options = {}) ⇒ Renderer


9
10
11
# File 'lib/simple_form_markdown_editor/renderer.rb', line 9

def initialize(str, options = {})
  super(str, options)
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options


4
5
6
# File 'lib/simple_form_markdown_editor/renderer.rb', line 4

def options
  @options
end

#strObject

Returns the value of attribute str


4
5
6
# File 'lib/simple_form_markdown_editor/renderer.rb', line 4

def str
  @str
end

Class Method Details

.call(*args) ⇒ Object


5
6
7
# File 'lib/simple_form_markdown_editor/renderer.rb', line 5

def self.call(*args)
  new(*args).call
end

Instance Method Details

#callObject


25
26
27
28
# File 'lib/simple_form_markdown_editor/renderer.rb', line 25

def call
  return unless str.present?
  markdown_renderer.render(str).html_safe
end

#extensionsObject


21
22
23
# File 'lib/simple_form_markdown_editor/renderer.rb', line 21

def extensions
  options.fetch(:extensions, MarkdownEditorInput.configuration.extensions)
end

#render_classObject


13
14
15
# File 'lib/simple_form_markdown_editor/renderer.rb', line 13

def render_class
  options.fetch(:render_class, MarkdownEditorInput.configuration.render_class)
end

#render_optionsObject


17
18
19
# File 'lib/simple_form_markdown_editor/renderer.rb', line 17

def render_options
  options.fetch(:render_options, MarkdownEditorInput.configuration.render_options)
end