Class: BrDanfe::DanfeLib::NfceLib::Document
- Inherits:
-
Object
- Object
- BrDanfe::DanfeLib::NfceLib::Document
show all
- Defined in:
- lib/br_danfe/danfe_lib/nfce_lib/document.rb
Instance Method Summary
collapse
Constructor Details
#initialize(page_width, page_height) ⇒ Document
Returns a new instance of Document.
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/br_danfe/danfe_lib/nfce_lib/document.rb', line 5
def initialize(page_width, page_height)
@document = BrDanfe::DocumentBuilder.build(
page_size: [page_width, page_height],
page_layout: :portrait,
left_margin: 0.3.cm,
right_margin: 0.3.cm,
top_margin: 0.3.cm,
botton_margin: 0
)
@document.font 'tinos'
@document.line_width = 0.3
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/br_danfe/danfe_lib/nfce_lib/document.rb', line 23
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
#render_blank_line(font_size = 6) ⇒ Object
19
20
21
|
# File 'lib/br_danfe/danfe_lib/nfce_lib/document.rb', line 19
def render_blank_line(font_size = 6)
@document.text ' ', size: font_size
end
|
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
31
32
33
|
# File 'lib/br_danfe/danfe_lib/nfce_lib/document.rb', line 31
def respond_to_missing?(method_name, include_private = false)
@document.respond_to?(method_name, include_private) || super
end
|