Class: Stats::Chart

Inherits:
Object
  • Object
show all
Defined in:
app/models/stats/chart.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action, dimensions = {}) ⇒ Chart


6
7
8
9
10
# File 'app/models/stats/chart.rb', line 6

def initialize(action, dimensions = {})
  @action = action
  @height = dimensions.fetch(:height) { 250 }
  @width = dimensions.fetch(:width) { 460 }
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action


5
6
7
# File 'app/models/stats/chart.rb', line 5

def action
  @action
end

#heightObject (readonly)

Returns the value of attribute height


5
6
7
# File 'app/models/stats/chart.rb', line 5

def height
  @height
end

#widthObject (readonly)

Returns the value of attribute width


5
6
7
# File 'app/models/stats/chart.rb', line 5

def width
  @width
end

Instance Method Details

#dimensionsObject


12
13
14
# File 'app/models/stats/chart.rb', line 12

def dimensions
  "#{width}x#{height}"
end