Method: Lookbook::CodeBeautifier#call

Defined in:
lib/lookbook/services/code/code_beautifier.rb

#callObject



12
13
14
15
16
17
18
19
# File 'lib/lookbook/services/code/code_beautifier.rb', line 12

def call
  language = opts.fetch(:language, "html")
  stripped_source = source.strip
  result = (language.downcase == "html") ? HtmlBeautifier.beautify(stripped_source, opts) : stripped_source
  result.to_s.strip.html_safe
rescue
  source.strip.html_safe
end