Class: PfrpgImport::HeroclassLevels
- Inherits:
-
Object
- Object
- PfrpgImport::HeroclassLevels
- Defined in:
- lib/pfrpg_import/heroclass_levels.rb
Instance Attribute Summary collapse
-
#levels ⇒ Object
readonly
Returns the value of attribute levels.
Instance Method Summary collapse
-
#initialize(csv_rows) ⇒ HeroclassLevels
constructor
A new instance of HeroclassLevels.
- #parse_levels(rows) ⇒ Object
- #to_level(row) ⇒ Object
Constructor Details
#initialize(csv_rows) ⇒ HeroclassLevels
Returns a new instance of HeroclassLevels.
5 6 7 |
# File 'lib/pfrpg_import/heroclass_levels.rb', line 5 def initialize(csv_rows) @levels = parse_levels(csv_rows) end |
Instance Attribute Details
#levels ⇒ Object (readonly)
Returns the value of attribute levels.
4 5 6 |
# File 'lib/pfrpg_import/heroclass_levels.rb', line 4 def levels @levels end |
Instance Method Details
#parse_levels(rows) ⇒ Object
9 10 11 |
# File 'lib/pfrpg_import/heroclass_levels.rb', line 9 def parse_levels(rows) rows.map { |row| to_level(row) } end |
#to_level(row) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/pfrpg_import/heroclass_levels.rb', line 13 def to_level(row) params = { level: row[0], bab: row[1], fort_save: row[2], ref_save: row[3], will_save: row[4], granted_features: row[5], choices: nil } return Level.new(params) end |