Class: KDoc::Decorators::TableDecorator
- Inherits:
-
KDecor::BaseDecorator
- Object
- KDecor::BaseDecorator
- KDoc::Decorators::TableDecorator
- Defined in:
- lib/k_doc/decorators/table_decorator.rb
Instance Method Summary collapse
-
#initialize ⇒ TableDecorator
constructor
A new instance of TableDecorator.
- #update(target, **opts) ⇒ Object
-
#update_fields(_target, _fields) ⇒ Object
What responsibility will this TableDecorator take on? Update fields/columns, or/and.
-
#update_rows(_target, _rows) ⇒ Object
Update row values/structure.
Constructor Details
#initialize ⇒ TableDecorator
Returns a new instance of TableDecorator.
6 7 8 9 10 |
# File 'lib/k_doc/decorators/table_decorator.rb', line 6 def initialize super(KDoc::Table) self.implemented_behaviours = %i[update_fields update_rows] end |
Instance Method Details
#update(target, **opts) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/k_doc/decorators/table_decorator.rb', line 12 def update(target, **opts) behaviour = opts[:behaviour] update_fields(target, target.get_fields) if %i[all update_fields].include?(behaviour) update_rows(target, target.get_rows) if %i[all update_rows].include?(behaviour) target end |
#update_fields(_target, _fields) ⇒ Object
What responsibility will this TableDecorator take on? Update fields/columns, or/and
23 24 25 |
# File 'lib/k_doc/decorators/table_decorator.rb', line 23 def update_fields(_target, _fields) raise KType::Error, 'Update fields not implement, you need to implement this method and ' end |
#update_rows(_target, _rows) ⇒ Object
Update row values/structure
28 |
# File 'lib/k_doc/decorators/table_decorator.rb', line 28 def update_rows(_target, _rows); end |