Class: ODT2HTML::DeclarationBlock
- Inherits:
-
Array
- Object
- Array
- ODT2HTML::DeclarationBlock
- Defined in:
- lib/odt2html-nsi/declaration_block.rb
Overview
Represents a CSS declaration block; a sequence of zero or more Declarations.
Instance Attribute Summary collapse
-
#block_used ⇒ Object
Returns the value of attribute block_used.
Instance Method Summary collapse
- #has_top_border? ⇒ Boolean
-
#initialize(*arglist) ⇒ DeclarationBlock
constructor
A new instance of DeclarationBlock.
- #to_s ⇒ Object
Constructor Details
#initialize(*arglist) ⇒ DeclarationBlock
Returns a new instance of DeclarationBlock.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/odt2html-nsi/declaration_block.rb', line 7 def initialize(*arglist) if (arglist[0].kind_of? DeclarationBlock) then dblock = arglist[0] super( 0 ) dblock.each do |item| push Declaration.new( item.property, item.value ) end else super end @block_used = false end |
Instance Attribute Details
#block_used ⇒ Object
Returns the value of attribute block_used.
5 6 7 |
# File 'lib/odt2html-nsi/declaration_block.rb', line 5 def block_used @block_used end |
Instance Method Details
#has_top_border? ⇒ Boolean
20 21 22 23 |
# File 'lib/odt2html-nsi/declaration_block.rb', line 20 def has_top_border? result = detect {|item| item.property =~ /border(-top)?/} return (result != nil) ? true : nil end |
#to_s ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/odt2html-nsi/declaration_block.rb', line 25 def to_s result = "{\n" sort{|a,b| a.property <=> b.property }.each { |item| result << "\t#{item.property}: #{item.value};\n" } result << "}\n" return result end |