Entries from August 2007 ↓
August 28th, 2007 — Rails, Ruby, SonicIQ
We are looking for a Ruby on Rails, XHTML & CSS Developer to join our team at SonicIQ. Head over to 43folders job board to view our ad.
These are exiting times with projects like Propel’r in the pipeline, along with the ever-growing opportunities for new and interesting client projects.
If you are a highly motivated developer and can see yourself in a Ruby on Rails position in sunny (sometimes) Bournemouth, UK then apply at 43folders.
| Tags: CSS, jobs, Rails, Ruby, xhtml
August 24th, 2007 — Rails, Rake, Ruby
To view the coverage of your plugins using Rcov, first install the rcov gem with sudo gem install rcov, then copy and paste the following onto the end of the Rakefile inside your plugin directory:
require 'rcov/rcovtask'
desc 'Measures test coverage using rcov'
namespace :rcov do
desc 'Output unit test coverage of plugin.'
Rcov::RcovTask.new(:unit) do |rcov|
rcov.pattern = 'test/unit/**/*_test.rb'
rcov.output_dir = 'rcov'
rcov.verbose = true
end
desc 'Output functional test coverage of plugin.'
Rcov::RcovTask.new(:functional) do |rcov|
rcov.pattern = 'test/functional/**/*_test.rb'
rcov.output_dir = 'rcov'
rcov.verbose = true
end
end
You can now simply run rake rcov from inside your plugin directory which will generate an rcov directory with the results. Open rcov/index.html (if you are on OSX this will open automatically) in a browser to view the results.
Thanks to Mike Clark for his Rcov rake task for Rails which this task is based on.
Update (11-11-08): Changed code to use the RcovTask class.
| Tags: coverage, plugins, Rails, rcov, tests
August 23rd, 2007 — Ruby
Just noticed something interesting (well not that interesting). Ternary operators in Ruby can be re-written using Boolean operators e.g.
method = object.respond_to?(:foo) ? :foo : :bar
would become…
method = object.respond_to?(:foo) && :foo || :bar
Simply replace ? with && and : with ||
I don’t know if there is any performance gain here, anyone care to investigate?
| Tags: boolean, operator, Ruby, ternary
August 17th, 2007 — Rails, Ruby, Typo
Is anyone else having problems with Typo 4.1 taking ages to process new comments. If anyone has any suggestions I would love to hear them (If you can be bothered to wait for the comment to go through!)
| Tags: comments, slow, Typo