Module: Docify::Format
Instance Method Summary collapse
-
#detect_format(filename) ⇒ Object
Detects markup format from filename.
-
#valid_format?(f) ⇒ Boolean
Detects if specified format is supported.
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
6 7 8 |
# File 'lib/docify/format.rb', line 6 def valid_format?(f) FORMATS.include?(f.to_sym) end |