Extract chart value object

This simplifies the views (slightly).
This commit is contained in:
Katrina Owen 2013-03-01 20:38:24 -05:00
parent 8b0f3e986a
commit 0aa6ea183b
7 changed files with 65 additions and 41 deletions

18
app/models/stats/chart.rb Normal file
View file

@ -0,0 +1,18 @@
module Stats
class Chart
attr_reader :action, :height, :width
def initialize(action, dimensions = {})
@action = action
@height = dimensions.fetch(:height) { 250 }
@width = dimensions.fetch(:width) { 460 }
end
def dimensions
"#{width}x#{height}"
end
end
end