Sha256: 9e5f0d076a7aa5b1ce5fa22c11eb8178383726133553aad906bdc2efa4d292d0

Contents?: true

Size: 745 Bytes

Versions: 1

Compression:

Stored size: 745 Bytes

Contents

class Styledown
  # Functional API for Styledown that interfaces via ExecJS. This is the
  # low-level API that the OOP API uses.
  module ClassMethods
    def context
      @context ||= begin
        require 'execjs'
        ExecJS.compile(Styledown::Source::SOURCE)
      end
    end

    def build(source, options = {})
      context.call('Styledown.build', source, options)
    end

    def render(data, options = {})
      context.call('Styledown.render', data, options)
    end

    # Reimplementation of Styledown.read(). Reads files and returns their
    # contents into a Hash.
    def read(paths, options = {})
      FileReader.read(paths, options)
    end

    def js_version
      context.eval('Styledown.version')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
styledown2-2.0.0.pre11 lib/styledown/class_methods.rb