Class: BrDanfe::MdfeLib::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/br_danfe/mdfe_lib/document.rb

Instance Method Summary collapse

Constructor Details

#initializeDocument

Returns a new instance of Document.



4
5
6
7
8
9
10
11
# File 'lib/br_danfe/mdfe_lib/document.rb', line 4

def initialize
  @document = BrDanfe::DocumentBuilder.build(
    page_size: 'A4',
    page_layout: :portrait
  )

  @document.font 'tinos'
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/br_danfe/mdfe_lib/document.rb', line 13

def method_missing(method_name, *args, &block)
  if @document.respond_to? method_name
    @document.send method_name, *args, &block
  else
    super
  end
end

Instance Method Details

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/br_danfe/mdfe_lib/document.rb', line 21

def respond_to_missing?(method_name, include_private = false)
  @document.respond_to?(method_name, include_private) || super
end