Class: Fat::AnnotationFixture
- Inherits:
-
Fit::ColumnFixture
- Object
- Fit::Fixture
- Fit::ColumnFixture
- Fat::AnnotationFixture
- Defined in:
- lib/fat/annotation_fixture.rb
Constant Summary
Constants inherited from Fit::Fixture
Fit::Fixture::GRAY, Fit::Fixture::GREEN, Fit::Fixture::RED, Fit::Fixture::YELLOW
Instance Attribute Summary collapse
-
#add_cell_following ⇒ Object
Returns the value of attribute add_cell_following.
-
#add_row_following ⇒ Object
Returns the value of attribute add_row_following.
-
#add_table_following ⇒ Object
Returns the value of attribute add_table_following.
-
#add_to_cell_body ⇒ Object
Returns the value of attribute add_to_cell_body.
-
#add_to_cell_tag ⇒ Object
Returns the value of attribute add_to_cell_tag.
-
#add_to_row_tag ⇒ Object
Returns the value of attribute add_to_row_tag.
-
#add_to_table_tag ⇒ Object
Returns the value of attribute add_to_table_tag.
-
#column ⇒ Object
Returns the value of attribute column.
-
#original_html ⇒ Object
Returns the value of attribute original_html.
-
#overwrite_cell_body ⇒ Object
Returns the value of attribute overwrite_cell_body.
-
#overwrite_cell_tag ⇒ Object
Returns the value of attribute overwrite_cell_tag.
-
#overwrite_end_cell_tag ⇒ Object
Returns the value of attribute overwrite_end_cell_tag.
-
#overwrite_end_row_tag ⇒ Object
Returns the value of attribute overwrite_end_row_tag.
-
#overwrite_end_table_tag ⇒ Object
Returns the value of attribute overwrite_end_table_tag.
-
#overwrite_row_tag ⇒ Object
Returns the value of attribute overwrite_row_tag.
-
#overwrite_table_tag ⇒ Object
Returns the value of attribute overwrite_table_tag.
-
#remove_following_cell ⇒ Object
Returns the value of attribute remove_following_cell.
-
#remove_following_row ⇒ Object
Returns the value of attribute remove_following_row.
-
#row ⇒ Object
Returns the value of attribute row.
Attributes inherited from Fit::Fixture
#args, #counts, #listener, #summary
Instance Method Summary collapse
- #add_parse(parse, new_string, tags) ⇒ Object
-
#initialize ⇒ AnnotationFixture
constructor
A new instance of AnnotationFixture.
- #remove_parse(parse) ⇒ Object
- #resulting_html ⇒ Object
- #strip_delimiters(string) ⇒ Object
Methods inherited from Fit::ColumnFixture
#check, #do_cell, #do_row, #do_rows, #execute, #reset
Methods inherited from Fit::Fixture
camel, #check, #do_cell, #do_cells, #do_row, #do_rows, #do_table, #do_tables, #error, escape, #exception, #find_class, #fixture_name, #get_args_for_table, #get_linked_fixture_with_args, gray, #ignore, #info, #interpret_following_tables, #interpret_tables, label, metadata, #parse, #right, #total_errors, #totals, #wrong
Constructor Details
#initialize ⇒ AnnotationFixture
Returns a new instance of AnnotationFixture.
20 21 22 23 |
# File 'lib/fat/annotation_fixture.rb', line 20 def initialize super @row = @column = 0 end |
Instance Attribute Details
#add_cell_following ⇒ Object
Returns the value of attribute add_cell_following.
11 12 13 |
# File 'lib/fat/annotation_fixture.rb', line 11 def add_cell_following @add_cell_following end |
#add_row_following ⇒ Object
Returns the value of attribute add_row_following.
11 12 13 |
# File 'lib/fat/annotation_fixture.rb', line 11 def add_row_following @add_row_following end |
#add_table_following ⇒ Object
Returns the value of attribute add_table_following.
11 12 13 |
# File 'lib/fat/annotation_fixture.rb', line 11 def add_table_following @add_table_following end |
#add_to_cell_body ⇒ Object
Returns the value of attribute add_to_cell_body.
11 12 13 |
# File 'lib/fat/annotation_fixture.rb', line 11 def add_to_cell_body @add_to_cell_body end |
#add_to_cell_tag ⇒ Object
Returns the value of attribute add_to_cell_tag.
11 12 13 |
# File 'lib/fat/annotation_fixture.rb', line 11 def add_to_cell_tag @add_to_cell_tag end |
#add_to_row_tag ⇒ Object
Returns the value of attribute add_to_row_tag.
11 12 13 |
# File 'lib/fat/annotation_fixture.rb', line 11 def add_to_row_tag @add_to_row_tag end |
#add_to_table_tag ⇒ Object
Returns the value of attribute add_to_table_tag.
11 12 13 |
# File 'lib/fat/annotation_fixture.rb', line 11 def add_to_table_tag @add_to_table_tag end |
#column ⇒ Object
Returns the value of attribute column.
11 12 13 |
# File 'lib/fat/annotation_fixture.rb', line 11 def column @column end |
#original_html ⇒ Object
Returns the value of attribute original_html.
11 12 13 |
# File 'lib/fat/annotation_fixture.rb', line 11 def original_html @original_html end |
#overwrite_cell_body ⇒ Object
Returns the value of attribute overwrite_cell_body.
11 12 13 |
# File 'lib/fat/annotation_fixture.rb', line 11 def overwrite_cell_body @overwrite_cell_body end |
#overwrite_cell_tag ⇒ Object
Returns the value of attribute overwrite_cell_tag.
11 12 13 |
# File 'lib/fat/annotation_fixture.rb', line 11 def overwrite_cell_tag @overwrite_cell_tag end |
#overwrite_end_cell_tag ⇒ Object
Returns the value of attribute overwrite_end_cell_tag.
11 12 13 |
# File 'lib/fat/annotation_fixture.rb', line 11 def overwrite_end_cell_tag @overwrite_end_cell_tag end |
#overwrite_end_row_tag ⇒ Object
Returns the value of attribute overwrite_end_row_tag.
11 12 13 |
# File 'lib/fat/annotation_fixture.rb', line 11 def overwrite_end_row_tag @overwrite_end_row_tag end |
#overwrite_end_table_tag ⇒ Object
Returns the value of attribute overwrite_end_table_tag.
11 12 13 |
# File 'lib/fat/annotation_fixture.rb', line 11 def overwrite_end_table_tag @overwrite_end_table_tag end |
#overwrite_row_tag ⇒ Object
Returns the value of attribute overwrite_row_tag.
11 12 13 |
# File 'lib/fat/annotation_fixture.rb', line 11 def overwrite_row_tag @overwrite_row_tag end |
#overwrite_table_tag ⇒ Object
Returns the value of attribute overwrite_table_tag.
11 12 13 |
# File 'lib/fat/annotation_fixture.rb', line 11 def overwrite_table_tag @overwrite_table_tag end |
#remove_following_cell ⇒ Object
Returns the value of attribute remove_following_cell.
11 12 13 |
# File 'lib/fat/annotation_fixture.rb', line 11 def remove_following_cell @remove_following_cell end |
#remove_following_row ⇒ Object
Returns the value of attribute remove_following_row.
11 12 13 |
# File 'lib/fat/annotation_fixture.rb', line 11 def remove_following_row @remove_following_row end |
#row ⇒ Object
Returns the value of attribute row.
11 12 13 |
# File 'lib/fat/annotation_fixture.rb', line 11 def row @row end |
Instance Method Details
#add_parse(parse, new_string, tags) ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/fat/annotation_fixture.rb', line 56 def add_parse parse, new_string, new_parse = Fit::Parse.new new_string, new_parse.more = parse.more new_parse.trailer = parse.trailer parse.more = new_parse parse.trailer = nil end |
#remove_parse(parse) ⇒ Object
64 65 66 67 |
# File 'lib/fat/annotation_fixture.rb', line 64 def remove_parse parse parse.trailer = parse.more.trailer parse.more = parse.more.more end |
#resulting_html ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/fat/annotation_fixture.rb', line 25 def resulting_html table = Fit::Parse.new original_html row = table.at 0, @row - 1 cell = row.at 0, @column - 1 cell.body = @overwrite_cell_body unless @overwrite_cell_body.nil? cell.add_to_body(@add_to_cell_body) unless @add_to_cell_body.nil? cell.tag = @overwrite_cell_tag unless @overwrite_cell_tag.nil? cell.end = @overwrite_end_cell_tag unless @overwrite_end_cell_tag.nil? cell.add_to_tag(strip_delimiters(@add_to_cell_tag)) unless @add_to_cell_tag.nil? row.tag = @overwrite_row_tag unless @overwrite_row_tag.nil? row.end = @overwrite_end_row_tag unless @overwrite_end_row_tag.nil? row.add_to_tag(strip_delimiters(@add_to_row_tag)) unless @add_to_row_tag.nil? table.tag = @overwrite_table_tag unless @overwrite_table_tag.nil? table.end = @overwrite_end_table_tag unless @overwrite_end_table_tag.nil? table.add_to_tag(strip_delimiters(@add_to_table_tag)) unless @add_to_table_tag.nil? add_parse(cell, @add_cell_following, ['td']) unless @add_cell_following.nil? remove_parse(cell) unless @remove_following_cell.nil? add_parse(row, @add_row_following, ['tr', 'td']) unless @add_row_following.nil? remove_parse(row) unless @remove_following_row.nil? add_parse(table, @add_table_following, ['table', 'tr', 'td']) unless @add_table_following.nil? generate_output table end |
#strip_delimiters(string) ⇒ Object
69 70 71 |
# File 'lib/fat/annotation_fixture.rb', line 69 def strip_delimiters string string.gsub(/^\[/, '').gsub(/\]$/, '') end |