<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: rails code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sat, 26 Jul 2008 20:41:55 GMT</pubDate>
    <description>DZone Snippets: rails code</description>
    <item>
      <title>Loading and parsing YAML files</title>
      <link>http://snippets.dzone.com/posts/show/287</link>
      <description>I use YAML heavily to specify basic configuration options for my applications.  Additionally, I have bash scripts to download and parse currency and weather information, which all gets stored as YAML for ease of use.&lt;br /&gt;&lt;br /&gt;This is how I parse the YAML into my applications:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;require 'yaml'&lt;br /&gt;&lt;br /&gt;class ApplicationController &lt; ActionController::Base&lt;br /&gt;  before_filter :configure_app&lt;br /&gt;&lt;br /&gt;  # Your code here...&lt;br /&gt;&lt;br /&gt;  def configure_app&lt;br /&gt;    @config = YAML::load(File.open("#{RAILS_ROOT}/config/config.yml"))&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 15 May 2005 11:20:22 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/287</guid>
      <author>darryl_ring (Darryl A. Ring)</author>
    </item>
  </channel>
</rss>
