Class: BrDanfe::DanfeLib::NfeLib::Vol

Inherits:
Object
  • Object
show all
Defined in:
lib/br_danfe/danfe_lib/nfe_lib/vol.rb

Constant Summary collapse

Y_POSITION =
18.01

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pdf, xml) ⇒ Vol

Returns a new instance of Vol.



9
10
11
12
13
14
15
16
# File 'lib/br_danfe/danfe_lib/nfe_lib/vol.rb', line 9

def initialize(pdf, xml)
  @pdf = pdf
  @xml = xml

  @y_position = Entrega.delivery_local?(@xml) ? Y_POSITION + 3.00 : Y_POSITION

  @l1 = @y_position
end

Instance Attribute Details

#y_positionObject (readonly)

Returns the value of attribute y_position.



5
6
7
# File 'lib/br_danfe/danfe_lib/nfe_lib/vol.rb', line 5

def y_position
  @y_position
end

Instance Method Details

#renderObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/br_danfe/danfe_lib/nfe_lib/vol.rb', line 18

def render
  nVol = 0

  @xml.collect('xmlns', 'vol') do |det|
    nVol += 1
    render_vol(det) if nVol < 2
  end

  render_blank_boxes if nVol.zero?

  nVol
end