Class: PfrpgImport::HeroclassWriter
- Inherits:
-
Object
- Object
- PfrpgImport::HeroclassWriter
- Includes:
- CaseHelpers
- Defined in:
- lib/pfrpg_import/heroclass_writer.rb
Instance Method Summary collapse
-
#initialize(facts, filename, path = './imported/') ⇒ HeroclassWriter
constructor
A new instance of HeroclassWriter.
- #print_class ⇒ Object
Methods included from CaseHelpers
#arrayify, #camelized_title, #underscored_title
Constructor Details
#initialize(facts, filename, path = './imported/') ⇒ HeroclassWriter
Returns a new instance of HeroclassWriter.
5 6 7 8 9 |
# File 'lib/pfrpg_import/heroclass_writer.rb', line 5 def initialize(facts, filename, path='./imported/') @facts = facts @filename = filename @path = path end |
Instance Method Details
#print_class ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pfrpg_import/heroclass_writer.rb', line 11 def print_class filename = "#{@path}#{underscored_title(@filename)}.rb" table = File.new(filename, "w") str = "class PfrpgClasses::#{camelized_title(@filename)} < PfrpgClasses::Heroclass\n" str += @facts.print_name str += @facts.print_hit_die str += @facts.print_starting_wealth str += @facts.print_bonuses_for_level str += @facts.print_create_feature str += @facts.print_alignment str += @facts.print_skills_per_level str += @facts.print_spells_bonus_attr str += @facts.print_spells_per_day str += @facts.print_description str += @facts.print_skills str += @facts.print_feature_type str += @facts.print_starting_feats str += "end" table.puts str table.close puts "Wrote #{filename}" end |