Class: Prawn::Format::Instructions::TagClose

Inherits:
Base
  • Object
show all
Defined in:
lib/prawn/format/instructions/tag_close.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#ascent, #descent, #state

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#accumulate, #discardable?, #height, #spaces, #start_verbatim?, #width

Constructor Details

#initialize(state, tag) ⇒ TagClose

Returns a new instance of TagClose.



17
18
19
20
# File 'lib/prawn/format/instructions/tag_close.rb', line 17

def initialize(state, tag)
  super(state)
  @tag = tag
end

Instance Attribute Details

#tagObject (readonly)

Returns the value of attribute tag.



15
16
17
# File 'lib/prawn/format/instructions/tag_close.rb', line 15

def tag
  @tag
end

Class Method Details

.close(state, tag, draw_state) ⇒ Object



10
11
12
13
# File 'lib/prawn/format/instructions/tag_close.rb', line 10

def self.close(state, tag, draw_state)
  closer = new(state, tag)
  closer.draw(state.document, draw_state)
end

Instance Method Details

#[](property) ⇒ Object



22
23
24
# File 'lib/prawn/format/instructions/tag_close.rb', line 22

def [](property)
  @tag[:style][property]
end

#break?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/prawn/format/instructions/tag_close.rb', line 33

def break?
  force_break?
end

#draw(document, draw_state, options = {}) ⇒ Object



26
27
28
29
30
31
# File 'lib/prawn/format/instructions/tag_close.rb', line 26

def draw(document, draw_state, options={})
  (@tag[:effects] || []).each do |effect|
    effect.finish(document, draw_state)
    draw_state[:pending_effects].delete(effect)
  end
end

#end_verbatim?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/prawn/format/instructions/tag_close.rb', line 45

def end_verbatim?
  @tag[:style][:white_space] == :pre
end

#force_break?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/prawn/format/instructions/tag_close.rb', line 41

def force_break?
  @tag[:style][:display] == :break
end

#styleObject



37
38
39
# File 'lib/prawn/format/instructions/tag_close.rb', line 37

def style
  @tag[:style]
end