class RDF::CSV::Format
Tabular Data/CSV format specification.
@example Obtaining a CSV
format class
RDF::Format.for(:csv) #=> RDF::CSV::Format RDF::Format.for(:tsv) #=> RDF::CSV::Format RDF::Format.for("etc/foaf.csv") RDF::Format.for("etc/foaf.tsv") RDF::Format.for(:file_name => "etc/foaf.csv") RDF::Format.for(:file_name => "etc/foaf.tsv") RDF::Format.for(:file_extension => "csv") RDF::Format.for(:file_extension => "tsv") RDF::Format.for(:content_type => "text/csv") RDF::Format.for(:content_type => "text/tab-separated-values")
@example Obtaining serialization format MIME types
RDF::Format.content_types #=> {"text/csv" => [RDF::CSV::Format]}
@example Obtaining serialization format file extension mappings
RDF::Format.file_extensions #=> {:csv => "text/csv"}
Public Class Methods
detect(sample)
click to toggle source
Sample detection to see if it matches JSON-LD
Use a text sample to detect the format of an input file. Sub-classes implement a matcher sufficient to detect probably format matches, including disambiguating between other similar formats.
@param [String] sample Beginning several bytes (~ 1K) of input. @return [Boolean]
# File lib/rdf/csv/format.rb, line 41 def self.detect(sample) !!sample.match(/^(?:(?:\w )+,(?:\w ))$/) end