Yaml Cookbook at the YamlForRuby site Welcome to the Yaml Cookbook for Ruby. This version of the Yaml Cookbook focuses on the Ruby implementation of Yaml by comparing Yaml documents with their Ruby counterparts. YAML(tm) is a readable text format for data structures. As you'll see below, YAML can handle many common data types and structures. And what YAML can't handle natively can be supported thr
To parse YAML with Ruby, do not use the YAML module, use Psych (which ships with Ruby 1.9.2, though there is also a gem). The reason is that YAML uses the unmaintained Syck library, whereas Psych uses the modern LibYAML: 1 2 3 4 5 6 7 >> require 'yaml' >> YAML.load("%YAML 1.1\n---\n'test'") # %YAML directive not supported => "%YAML 1.1 --- 'test'" >> require 'psych' >> Psych.load("%YAML 1.1\n---\n
I would like to know how to parse a YAML file with the following contents: --- javascripts: - fo_global: - lazyload-min - holla-min Currently I am trying to parse it this way: @custom_asset_packages_yml = (File.exists?("#{RAILS_ROOT}/config/asset_packages.yml") ? YAML.load_file("#{RAILS_ROOT}/config/asset_packages.yml") : nil) if !@custom_asset_packages_yml.nil? @custom_asset_packages_yml['javascr
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く