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

Returns a new instance of Chart.



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

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.



3
4
5
# File 'app/models/stats/chart.rb', line 3

def action
  @action
end

#heightObject (readonly)

Returns the value of attribute height.



3
4
5
# File 'app/models/stats/chart.rb', line 3

def height
  @height
end

#widthObject (readonly)

Returns the value of attribute width.



3
4
5
# File 'app/models/stats/chart.rb', line 3

def width
  @width
end

Instance Method Details

#dimensionsObject



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

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