Arlen Cuss
11/10/2007 9:34:00 PM
Hi,
On Sat, 2007-11-10 at 22:55 +0900, Junkone wrote:
> i have a simple yml file and am trying to parse it.
>
> development:
> TWSDirectory: E:\Jts\dlqkjifys> Second: E:\Jts\test>
First, make sure your items are indented at the same level:
development:
TWSDirectory: E:\Jts\dlqkjifys Second: E:\Jts\test
Notice the way "TWSDirectory" and "Second" have the same number of
spaces before them.
This may still not work. Have a look at this example:
irb(main):008:0> YAML.load <<-YAML
irb(main):009:0" abcdefgirb(main):010:0" hijkl
irb(main):011:0" YAML
=> "abcdefghijkl"
Your "\" at the end of the line is joining the two lines into one!
Suffice to say, this works:
irb(main):017:0> YAML.load <<YAML
irb(main):018:0" development:
irb(main):019:0" TWSDirectory: E:\Jts\dlqkjifys
irb(main):020:0" Second: E:\Jts\test
irb(main):021:0" YAML
=> {"development"=>{"TWSDirectory"=>"E:Jtsdlqkjifys", "Second"=>"E:Jts
\test"}}
irb(main):022:0>
> i get a error that i am not able to comprehend. pl help
> irb(main):020:0> conf = YAML::load(File.open(RailsDirectory+ 'config/
> constants.y
> ml'))
> 'rgumentError: syntax error on line 5, col 12: ` Second: E:\Jts
> \test> from e:/ruby/lib/ruby/1.8/yaml.rb:133:in `load'
> from e:/ruby/lib/ruby/1.8/yaml.rb:133:in `load'
> from (irb):20
>
>
Hope this helps,
Arlen