Sha256: 8a3e8d1fc0731c64e50b5102a1baa9beaa3262520f28cfa21f6ccb603f7d91b2

Contents?: true

Size: 444 Bytes

Versions: 6

Compression:

Stored size: 444 Bytes

Contents

# 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.

def File.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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
facets-1.8.49 lib/facets/core/file/self/yaml.rb
facets-1.8.20 lib/facets/core/file/self/yaml.rb
facets-1.8.0 lib/facets/core/file/self/yaml.rb
facets-1.8.51 lib/facets/core/file/self/yaml.rb
facets-1.8.54 lib/facets/core/file/self/yaml.rb
facets-1.8.8 lib/facets/core/file/self/yaml.rb