Module: ActAsPageExtractor::ClassMethods

Defined in:
lib/act_as_page_extractor.rb

Instance Method Summary collapse

Instance Method Details

#act_as_page_extractor(options: {}) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/act_as_page_extractor.rb', line 31

def act_as_page_extractor(options: {})
  define_method(:save_as_pdf){|*args| options[:save_as_pdf] }
  define_method(:extracted_filename){|*args| self.send(options[:filename].to_sym) }
  ActAsPageExtractor.define_singleton_method(:extracted_filename) {|*args| options[:filename] }
  ActAsPageExtractor.define_singleton_method(:document_class) {|*args| Object.const_get(options[:document_class]) }
  define_method(:extracted_document_id){|*args| options[:document_id] }
  define_method(:additional_fields){|*args| options[:additional_fields] || [] }
  define_method(:file_storage){|*args| options[:file_storage] || FILE_STORAGE }
  define_method(:pdf_storage){|*args| options[:pdf_storage] || PDF_STORAGE }
end