Module: TableExtended
- Defined in:
- lib/rbcurse/extras/tableextended.rb
Overview
Provides extended abilities to a table so user does not need to code it into his app. At the same time, i don’t want to weigh down Table with too much functionality/ I am putting in some stuff, so that table columns can be resized, using multipliers. That allows us to redistribute the space taken or released across rows. Other options: dd, C, . (repeat) and how about range operations
Instance Method Summary collapse
-
#decrease_column(num = (($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier)) ⇒ Object
decrease the focused column If no size passed, then use numeric multiplier, else 1 Typically, one would bind a key such as - to this method.
-
#increase_column(num = (($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier)) ⇒ Object
increase the focused column If no size passed, then use numeric multiplier, else 1 Typically, one would bind a key such as + to this method e.g.
Instance Method Details
#decrease_column(num = (($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier)) ⇒ Object
decrease the focused column If no size passed, then use numeric multiplier, else 1 Typically, one would bind a key such as - to this method
28 29 30 31 32 33 34 35 36 |
# File 'lib/rbcurse/extras/tableextended.rb', line 28 def decrease_column num=(($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier) acolumn = column focussed_col() w = acolumn.width - num $multiplier = 0 if w > 3 acolumn.width w #atable.table_structure_changed end end |
#increase_column(num = (($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier)) ⇒ Object
increase the focused column If no size passed, then use numeric multiplier, else 1 Typically, one would bind a key such as + to this method e.g. atable.bind_key(?+) { atable.increase_column ; } See examples/viewtodo.rb for usage
16 17 18 19 20 21 22 23 24 |
# File 'lib/rbcurse/extras/tableextended.rb', line 16 def increase_column num=(($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier) acolumn = column focussed_col() #num = $multiplier || 1 $multiplier = 0 w = acolumn.width + num acolumn.width w #atable.table_structure_changed end |