Class: USPSFlags::Grades::Grade
- Inherits:
-
Object
- Object
- USPSFlags::Grades::Grade
- Defined in:
- lib/usps_flags/grades/grade.rb
Class Method Summary collapse
Class Method Details
.get(grade) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/usps_flags/grades/grade.rb', line 11 def get(grade) return if grade.nil? raise USPSFlags::Errors::InvalidInsignia, "Unknown grade: #{grade}" unless valid_grades.include?(grade) send(grade) end |
.valid_grades ⇒ Object
18 19 20 |
# File 'lib/usps_flags/grades/grade.rb', line 18 def valid_grades i[s p ap jn n sn] end |
.width(grade) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/usps_flags/grades/grade.rb', line 22 def width(grade) case grade when :ap USPSFlags::Config::GRADE_SPACING * 2.25 + 100 when :jn USPSFlags::Config::GRADE_SPACING * 3 + 10 when :n USPSFlags::Config::GRADE_SPACING * 5 + 45 end end |