Sha256: 05164cdd93ea472a463cb1bb118cf910ddcc7d0d38a49d6279dd367b1263407b

Contents?: true

Size: 403 Bytes

Versions: 1

Compression:

Stored size: 403 Bytes

Contents

module RMark
  class Handler
    def call(template)
      begin
        extend "::RMark::Parsers::#{setting.parser}".constantize
      rescue NameError
        raise ConfigurationError, 'Parser supports only :Redcarpet, :RDiscount, and :Kramdown'
      end

      parse(template.source, setting.options).inspect + '.html_safe'
    end

    private

    def setting
      RMark.setting
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
r_mark-0.0.1 lib/r_mark/handler.rb