Class: ODDB::FiPDF::OrphanRule

Inherits:
Rule show all
Defined in:
ext/fipdf/src/rules.rb

Instance Attribute Summary collapse

Attributes inherited from Rule

#name

Instance Method Summary collapse

Methods inherited from Rule

#initialize

Constructor Details

This class inherits a constructor from ODDB::FiPDF::Rule

Instance Attribute Details

#linesObject (readonly)

Returns the value of attribute lines.



26
27
28
# File 'ext/fipdf/src/rules.rb', line 26

def lines
  @lines
end

#pagebreakObject (readonly)

Returns the value of attribute pagebreak.



26
27
28
# File 'ext/fipdf/src/rules.rb', line 26

def pagebreak
  @pagebreak
end

Instance Method Details

#fulfilled?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'ext/fipdf/src/rules.rb', line 27

def fulfilled?
	(@pagebreak == 0) || (@lines < 2) || (@pagebreak > 1)
end

#notify(event) ⇒ Object



30
31
32
33
34
35
36
37
# File 'ext/fipdf/src/rules.rb', line 30

def notify(event)
	case event
	when :add_text_wrap
		@lines += 1
	when :ez_new_page
		@pagebreak = @lines unless @pagebreak > 0
	end
end