Class: Docp::TableDoc
- Inherits:
-
Object
- Object
- Docp::TableDoc
- Includes:
- Enumerable
- Defined in:
- lib/docp/table_doc.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
-
#tables ⇒ Object
readonly
Returns the value of attribute tables.
Instance Method Summary collapse
- #any? ⇒ Boolean
- #each ⇒ Object
- #empty? ⇒ Boolean
- #header_required_undefineds ⇒ Object
-
#initialize ⇒ TableDoc
constructor
A new instance of TableDoc.
- #parse(parse_doc, header_parser, &block) ⇒ Object
- #rows(&block) ⇒ Object
Constructor Details
Instance Attribute Details
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
4 5 6 |
# File 'lib/docp/table_doc.rb', line 4 def doc @doc end |
#tables ⇒ Object (readonly)
Returns the value of attribute tables.
4 5 6 |
# File 'lib/docp/table_doc.rb', line 4 def tables @tables end |
Instance Method Details
#any? ⇒ Boolean
37 38 39 |
# File 'lib/docp/table_doc.rb', line 37 def any? @tables.any? end |
#each ⇒ Object
18 19 20 |
# File 'lib/docp/table_doc.rb', line 18 def each @tables.each {|table| yield table } end |
#empty? ⇒ Boolean
33 34 35 |
# File 'lib/docp/table_doc.rb', line 33 def empty? @tables.empty? end |
#header_required_undefineds ⇒ Object
29 30 31 |
# File 'lib/docp/table_doc.rb', line 29 def header_required_undefineds @tables.map(&:header_required_undefineds).compact end |
#parse(parse_doc, header_parser, &block) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/docp/table_doc.rb', line 10 def parse parse_doc, header_parser, &block Docp::Table.find(parse_doc, header_parser) do|table, header_tr, header_index| @tables << Docp::Table.new(@doc, header_parser, table, header_tr, header_index) block.call @tables.last if block_given? end self end |
#rows(&block) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/docp/table_doc.rb', line 22 def rows &block @tables.map(&:rows).flatten.map {|row| yield row if block_given? row } end |