awestruct/awestruct — pull request #173 by msavy (2012-09-07 11:27:04+00:00)
Title: Fix incorrect boolean false return

Fix subtle bug that causes Ruby 1.9.x to return stored 'false' boolean values as nil due to || evaluation

Ruby 1.9

[2] pry(main)> require 'astruct'
=> true
[3] pry(main)> as2 = Awestruct::AStruct.new
=> {}
[4] pry(main)> as2.pae=false
=> false
[5] pry(main)> as2.pae
=> nil <--------- nil
[6] pry(main)> as2.pae_test=true
=> true
[7] pry(main)> as2.pae_test
=> true

After fix

[4] pry(main)> as = BoxGrinder::AStruct.new(:awestruct => false)
=> {:awestruct=>false}
[5] pry(main)> as.awestruct
=> false