Class: ZenPush::Markdown

Inherits:
Object
  • Object
show all
Defined in:
lib/zenpush/markdown.rb

Class Method Summary collapse

Class Method Details

.select_flavor(flavor) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/zenpush/markdown.rb', line 17

def self.select_flavor(flavor)
  flavor ||= :standard
  flavor_class_name = flavor.to_s.capitalize.to_sym
  if ZenPush::Flavors.const_defined?(flavor_class_name)
    ZenPush::Flavors.const_get(flavor_class_name)
  else
    raise "The '#{flavor}' flavor is not supported. Use: #{ZenPush::Flavors::NAMES.join(', ')}."
  end
end

.to_zendesk_html(file, flavor = nil) ⇒ Object



13
14
15
# File 'lib/zenpush/markdown.rb', line 13

def self.to_zendesk_html(file, flavor=nil)
  select_flavor(flavor).to_html(File.read(file))
end