Class: Hieroglyph::CharacterSheet
- Inherits:
-
Object
- Object
- Hieroglyph::CharacterSheet
- Defined in:
- lib/hieroglyph/character_sheet.rb
Constant Summary collapse
- @@montage_args =
{ '-background' => '#ffffff', '-fill' => '#000000', '-mattecolor' => '#ffffff', '-geometry' => '150x150+25+25', '-label' => '%t' }
Instance Attribute Summary collapse
-
#files ⇒ Object
Returns the value of attribute files.
-
#output_path ⇒ Object
Returns the value of attribute output_path.
Instance Method Summary collapse
- #add(file) ⇒ Object
-
#initialize(options) ⇒ CharacterSheet
constructor
A new instance of CharacterSheet.
- #save ⇒ Object
Constructor Details
#initialize(options) ⇒ CharacterSheet
Returns a new instance of CharacterSheet.
17 18 19 20 21 22 |
# File 'lib/hieroglyph/character_sheet.rb', line 17 def initialize() = @output_path = File.join([:output_folder], [:name]) + '_characters.png' Hieroglyph.delete @output_path @files = [] end |
Instance Attribute Details
#files ⇒ Object
Returns the value of attribute files.
7 8 9 |
# File 'lib/hieroglyph/character_sheet.rb', line 7 def files @files end |
#output_path ⇒ Object
Returns the value of attribute output_path.
7 8 9 |
# File 'lib/hieroglyph/character_sheet.rb', line 7 def output_path @output_path end |
Instance Method Details
#add(file) ⇒ Object
24 25 26 |
# File 'lib/hieroglyph/character_sheet.rb', line 24 def add(file) @files.push file end |
#save ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/hieroglyph/character_sheet.rb', line 28 def save cmd = ['montage'] @@montage_args['title'] = [:name] @@montage_args.each do |arg, value| cmd.push arg cmd.push value end @files.each do |file| cmd.push file end cmd.push @output_path cmd = Escape.shell_command(cmd) system(cmd) Hieroglyph.success "Character sheet saved: #{File.expand_path(@options[:output_folder])}/#{@options[:name]}_characters.svg" end |