Module: Mumukit::ContentType::BaseContentType

Included in:
Html, Markdown, Plain
Defined in:
lib/mumukit/content_type.rb

Instance Method Summary collapse

Instance Method Details

#as_json(_options = {}) ⇒ Object



21
22
23
# File 'lib/mumukit/content_type.rb', line 21

def as_json(_options={})
  name
end

#format_exception(e) ⇒ Object



7
8
9
# File 'lib/mumukit/content_type.rb', line 7

def format_exception(e)
  "#{title e.message}\n#{code e.backtrace.join("\n")}"
end

#to_html(content, options = {}) ⇒ Object



11
12
13
14
15
# File 'lib/mumukit/content_type.rb', line 11

def to_html(content, options={})
  content_html = htmlize content, options
  content_html = Mumukit::ContentType::Sanitizer.sanitize(content_html) unless options[:skip_sanitization]
  content_html&.html_safe
end

#to_sObject



17
18
19
# File 'lib/mumukit/content_type.rb', line 17

def to_s
  name
end