Class: Inch::Badge::Image::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/inch/badge/image/base.rb

Direct Known Subclasses

PNG, SVG

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename, numbers, style = :default) ⇒ Base

Returns a new instance of Base.



7
8
9
10
11
12
13
14
15
# File 'lib/inch/badge/image/base.rb', line 7

def initialize(filename, numbers, style = :default)
  @filename = filename
  @numbers = numbers.map(&:to_i)
  @style = style
  @overall = @numbers.inject(0, :+)
  @grades = Config::GRADE_ORDER.map.with_index do |name, index|
      GradeSection.new(name, Config::GRADE_COLOR[index], @numbers[index], @overall)
    end
end

Instance Attribute Details

#styleObject (readonly)

Returns the value of attribute style.



5
6
7
# File 'lib/inch/badge/image/base.rb', line 5

def style
  @style
end