Methods
yaml?
Public Class methods
Is a file a YAML file?
Note this isn‘t perfect. At present it depends on the use use of an initial document separator (eg. ’—’). With YAML 1.1 the %YAML delaration will be manditory, so in the future this can be adapted to fit that standard.
[ + ]
# File lib/lore/facets/yaml.rb, line 65 def self.yaml?(file) File.open(file) do |f| until f.eof? line = f.gets break true if line =~ /^---/ break false unless line =~ /^(\s*#.*?|\s*)$/ end end end