Skip to content

Instantly share code, notes, and snippets.

@benhoskings
Forked from benaskins/helper.rb
Created April 9, 2009 05:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benhoskings/92272 to your computer and use it in GitHub Desktop.
Save benhoskings/92272 to your computer and use it in GitHub Desktop.
def value_for_label object, method
(object && object.send(method)) || "-"
end
def conditions_map_for conditions
{
:dp_c => 'Dew point',
:rh => 'Relative humidity',
:feels_like_c => 'feels like',
:wind_dir_and_speed => 'Wind',
:rainfall_mm => "Rainfall #{conditions.rainfall_mm_period if conditions}"
}
end
.conditions
%dl
- conditions_map_for(@conditions).each do |method,label|
%dt= label
%dd= value_for_label @conditions, method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment