Skip to content

Instantly share code, notes, and snippets.

@adgilfillan
Created May 9, 2013 22:07
Show Gist options
  • Save adgilfillan/5550992 to your computer and use it in GitHub Desktop.
Save adgilfillan/5550992 to your computer and use it in GitHub Desktop.
(2..7).each do |num|
define_method("whip_#{num}") do
if ((self.age + num) < 30)
(eval("self.whip_#{num-1}") * 0.95)
else
(eval("self.whip_#{num-1}") * 1.05)
end
end
end
<% (1..7).each do |bagel| %>
<p>
<b>Age: <%= @pitcher.age + (bagel - 1) %></b>
<b>Whip <%= bagel %>:</b>
<%= eval("@pitcher.whip_#{bagel}").round(2) %>
</p>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment