Sha256: 615a5b2e438e3161a73f9ca4c3d3135bea36ec4d9fbd031c967a656de0ef2fec

Contents?: true

Size: 595 Bytes

Versions: 2

Compression:

Stored size: 595 Bytes

Contents

module Docify
  FORMATS = [:markdown, :textile, :rdoc]
  
  module Format
    # Detects if specified format is supported
    def valid_format?(f)
      FORMATS.include?(f.to_sym)
    end
    
    # Detects markup format from filename
    def detect_format(filename)
      case(filename)
        when /\.rdoc/i
          :rdoc
        when /\.(md|mkdn?|mdown|markdown)/i
          :markdown
        when /\.textile/i
          :textile
      end
    end
  end

  # Returns true if given format is supported
  #
  def self.valid_format?(f)
    f.nil? ? false : FORMATS.include?(f.to_sym)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
docify-1.0.7 lib/docify/format.rb
docify-1.0.6 lib/docify/format.rb