Module: Docify::Format

Included in:
Docify, Document
Defined in:
lib/docify/format.rb

Instance Method Summary collapse

Instance Method Details

#detect_format(filename) ⇒ Object

Detects markup format from filename



11
12
13
14
15
16
17
18
19
20
# File 'lib/docify/format.rb', line 11

def detect_format(filename)
  case(filename)
    when /\.rdoc/i
      :rdoc
    when /\.(md|mkdn?|mdown|markdown)/i
      :markdown
    when /\.textile/i
      :textile
  end
end

#valid_format?(f) ⇒ Boolean

Detects if specified format is supported

Returns:

  • (Boolean)


6
7
8
# File 'lib/docify/format.rb', line 6

def valid_format?(f)
  FORMATS.include?(f.to_sym)
end