Class: SheetFiller::Doc::Wrapper
- Inherits:
-
Struct
- Object
- Struct
- SheetFiller::Doc::Wrapper
- Defined in:
- lib/sheet_filler/doc/wrapper.rb
Instance Attribute Summary collapse
-
#form_path ⇒ Object
Returns the value of attribute form_path.
-
#output_path ⇒ Object
Returns the value of attribute output_path.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
Instance Attribute Details
#form_path ⇒ Object
Returns the value of attribute form_path
5 6 7 |
# File 'lib/sheet_filler/doc/wrapper.rb', line 5 def form_path @form_path end |
#output_path ⇒ Object
Returns the value of attribute output_path
5 6 7 |
# File 'lib/sheet_filler/doc/wrapper.rb', line 5 def output_path @output_path end |
#type ⇒ Object
Returns the value of attribute type
5 6 7 |
# File 'lib/sheet_filler/doc/wrapper.rb', line 5 def type @type end |
Instance Method Details
#fill(data) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/sheet_filler/doc/wrapper.rb', line 18 def fill(data) if type == "fill_form" parser.fill_form(data) else parser.replace(data) end parser.save(output_path) output_path end |
#parse_fields(data) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/sheet_filler/doc/wrapper.rb', line 10 def parse_fields(data) if type == "fill_form" Parser.fields(form_path).map(&:name) else data end end |
#parser ⇒ Object
6 7 8 |
# File 'lib/sheet_filler/doc/wrapper.rb', line 6 def parser @parser ||= WordXmlFile.new(form_path) end |