Permalink
Browse files

preferring psych if available

  • Loading branch information...
1 parent e64e5a1 commit 663d13e817c8580a4c5d7358d9d4c0012daaeb1b @tenderlove committed Jan 1, 2011
Showing with 8 additions and 4 deletions.
  1. +0 −2 README.rdoc
  2. +8 −2 app/models/account.rb
View
@@ -4,8 +4,6 @@ This is the source code for the rubycommitters.org website.
== Hacking
-Ruby 1.9.2 is required!!!!
-
First clone the repo:
$ git clone git://github.com/tenderlove/rubycommitters.org.git
View
@@ -10,9 +10,15 @@ class Account < ActiveRecord::Base
# Import +io+ object that contains a YAML representation of the
# ruby-committers
def self.import io
- require 'psych'
+ begin
+ require 'psych'
+ yamler = Psych
+ rescue LoadError
+ require 'yaml'
+ yamler = YAML
+ end
- doc = Psych.load io
+ doc = yamler.load io
doc.each do |record|
account = Account.create!(:username => record['account'])
(record['name'] || []).each do |name|

0 comments on commit 663d13e

Please sign in to comment.