we have understood the concept of fluent api but now we want to look over some existing fluent api for better understanding. where can i find such examples. have searched alot but could not find it.
A:
May I suggest rspec? Here are a few lines from different real-world rspec specifications:
SQL.should_receive(:connect).with(config).and_return(connection1)
file_warehouse.should_receive(:delete).ordered.once.with(@keystring, paths)
arguments.should_receive(:config).with(no_args).any_number_of_times.and_return(config_path)
Wayne Conrad
2010-05-18 21:29:44
+1
A:
Arel is pretty awesome:
users.where(users[:name].eq('bob').or(users[:age].lt(25)))
comments.join(replies).on(replies[:parent_id].eq(comments[:id]))
Miguel Fonseca
2010-05-18 22:19:14
hey thnks..v unerstood this piece of code but we want to see the working of itbut v cannot run this code as the actual methods are not defined..can u give us some more examples so tht v can run them and see the results also
intern
2010-05-19 04:52:40
arel is part of ruby on rails 3, try installing it and give it a shot
Miguel Fonseca
2010-05-19 15:50:04