bin/ft_console in fat_table-0.2.3 vs bin/ft_console in fat_table-0.2.4

- old
+ new

@@ -2,11 +2,11 @@ require 'bundler/setup' require 'fat_table' require 'pry' -data = +@data = [['Date', 'Code', 'Raw', 'Shares', 'Price', 'Info', 'Ok'], ['2013-05-29', 'S', 15_700.00, 6601.85, 24.7790, 'ENTITY3', 'F'], ['2013-05-02', 'P', 118_186.40, 118_186.4, 11.8500, 'ENTITY1', 'T'], ['2013-05-20', 'S', 12_000.00, 5046.00, 28.2804, 'ENTITY3', 'F'], ['2013-05-23', 'S', 8000.00, 3364.00, 27.1083, 'ENTITY3', 'T'], @@ -17,11 +17,11 @@ ['2013-05-20', 'S', 33_302.00, 14_003.49, 28.6383, 'ENTITY3', 'T'], ['2013-05-29', 'S', 15_900.00, 6685.95, 24.5802, 'ENTITY3', 'T'], ['2013-05-30', 'S', 6_679.00, 2808.52, 25.0471, 'ENTITY3', 'T'], ['2013-05-23', 'S', 23_054.00, 9694.21, 26.8015, 'ENTITY3', 'F']] -tab_a_str = <<-EOS +@tab_a_str = <<-EOS | Id | Name | Age | Address | Salary | Join Date | |----+-------+-----+------------+--------+------------| | 1 | Paul | 32 | California | 20000 | 2001-07-13 | | 3 | Teddy | 23 | Norway | 20000 | 2007-12-13 | | 4 | Mark | 25 | Rich-Mond | 65000 | 2007-12-13 | @@ -30,22 +30,22 @@ | 8 | Paul | 24 | Houston | 20000 | 2005-07-13 | | 9 | James | 44 | Norway | 5000 | 2005-07-13 | | 10 | James | 45 | Texas | 5000 | | EOS -tab_b_str = <<-EOS +@tab_b_str = <<-EOS | Id | Dept | Emp Id | |----+-------------+--------| | 1 | IT Billing | 1 | | 2 | Engineering | 2 | | 3 | Finance | 7 | EOS -tab_a = FatTable.from_org_string(tab_a_str) -tab_b = FatTable.from_org_string(tab_b_str) +@tab_a = FatTable.from_org_string(@tab_a_str) +@tab_b = FatTable.from_org_string(@tab_b_str) -tab1_str = <<-EOS +@tab1_str = <<-EOS | Ref | Date | Code | Price | G10 | QP10 | Shares | LP | QP | IPLP | IPQP | |------+------------------+------+--------+-----+------+--------+------+-------+--------+--------| | T001 | [2016-11-01 Tue] | P | 7.7000 | T | F | 100 | 14 | 86 | 0.2453 | 0.1924 | | T002 | [2016-11-01 Tue] | P | 7.7500 | T | F | 200 | 28 | 172 | 0.2453 | 0.1924 | | T003 | [2016-11-01 Tue] | P | 7.5000 | F | T | 800 | 112 | 688 | 0.2453 | 0.1924 | @@ -68,11 +68,11 @@ | T014 | [2016-11-02 Wed] | P | 7.4500 | F | T | 5847 | 835 | 5012 | 0.2453 | 0.1924 | | T015 | [2016-11-02 Wed] | P | 7.7500 | F | F | 500 | 72 | 428 | 0.2453 | 0.1924 | | T016 | [2016-11-02 Wed] | P | 8.2500 | T | T | 100 | 14 | 86 | 0.2453 | 0.1924 | EOS -tab2_str = <<-EOS +@tab2_str = <<-EOS | Ref | Date | Code | Price | G10 | QP10 | Shares | LP | QP | IPLP | IPQP | |------+------------------+------+--------+-----+------+--------+-------+------+--------+--------| | T003 | [2016-11-01 Tue] | P | 7.5000 | F | T | 800 | 112 | 688 | 0.2453 | 0.1924 | | T003 | [2016-11-01 Tue] | P | 7.5000 | F | T | 800 | 112 | 688 | 0.2453 | 0.1924 | | T017 | [2016-11-01 Tue] | P | 8.3 | F | T | 1801 | 1201 | 600 | 0.2453 | 0.1924 | @@ -91,14 +91,14 @@ | T020 | [2017-01-19 Thu] | S | 8.25 | F | T | 700 | 615 | 85 | 0.2453 | 0.1924 | | T021 | [2017-01-23 Mon] | P | 7.16 | T | T | 12100 | 11050 | 1050 | 0.2453 | 0.1924 | | T021 | [2017-01-23 Mon] | P | 7.16 | T | T | 12100 | 11050 | 1050 | 0.2453 | 0.1924 | EOS -tab1 = FatTable.from_org_string(tab1_str) -tab2 = FatTable.from_org_string(tab2_str) +@tab1 = FatTable.from_org_string(@tab1_str) +@tab2 = FatTable.from_org_string(@tab2_str) -AOA = [['Ref', 'Date', 'Code', 'Raw', 'Shares', 'Price', 'Info', 'Bool'], +@aoa = [['Ref', 'Date', 'Code', 'Raw', 'Shares', 'Price', 'Info', 'Bool'], [1, '2013-05-02', 'P', 795_546.20, 795_546.2, 1.1850, 'YLPEF1', 'T'], [2, '2013-05-02', 'P', 118_186.40, 118_186.4, 11.8500, 'YLPEF1', 'T'], [7, '2013-05-20', 'S', 12_000.00, 5046.00, 28.2804, 'YLEAC', 'F'], [8, '2013-05-20', 'S', 85_000.00, 35_742.50, 28.3224, 'YLEAC', 'T'], [9, '2013-05-20', 'S', 33_302.00, 14_003.49, 28.6383, 'YLEAC', 'T'], @@ -107,13 +107,8 @@ [12, '2013-05-23', 'S', 39_906.00, 16_780.47, 25.1749, 'YLEAC', 'T'], [13, '2013-05-29', 'S', 13_459.00, 5659.51, 24.7464, 'YLEAC', 'T'], [14, '2013-05-29', 'S', 15_700.00, 6601.85, 24.7790, 'YLEAC', 'F'], [15, '2013-05-29', 'S', 15_900.00, 6685.95, 24.5802, 'YLEAC', 'T'], [16, '2013-05-30', 'S', 6_679.00, 2808.52, 25.0471, 'YLEAC', 'T']] -tt = FatTable.from_aoa(AOA) +@tt = FatTable.from_aoa(@aoa) -binding.pry -instr <<-EOS -FatTable console sets up some sample tables you can play with (see ls) - - For example, try 'puts tab1.to_term' -EOS +Pry.start