Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Ruby Implementation #44

Draft
wants to merge 43 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
ad225f1
init commit
robertDurst Apr 9, 2023
a49178f
remove sorbet, create schema & row classes
robertDurst Apr 11, 2023
4e6bf9b
begin add column and codify ensures/requires
robertDurst Apr 11, 2023
45a1556
tests pass for data structs closer adhering to paper
robertDurst Apr 11, 2023
21cee35
especially hacky, but satisfying source code reflecting require/ensur…
robertDurst Apr 11, 2023
14e366f
work on build_column
robertDurst Apr 13, 2023
485afb8
un-negate assertions
robertDurst Apr 14, 2023
325c296
add progress to README, need to fill in what I have done thus far
robertDurst Apr 14, 2023
8a26b7d
begin working way down list of TODOs one at a time w/ tests
robertDurst Apr 15, 2023
0d33310
finish up basic functions
robertDurst Apr 15, 2023
4f79691
fix semantics of an empty table
robertDurst Apr 15, 2023
0abdf7f
fix basics to be importable module, implement table properties
robertDurst Apr 15, 2023
4e9a2f2
re-org'd to implement b2t2 closer, added rubocop for style
robertDurst Apr 15, 2023
4535b1e
Access Subcomponents
robertDurst Apr 16, 2023
a3b7db4
test type assertions, tests for empty_table, reimplement add_rows
robertDurst Apr 17, 2023
cbd603f
add column and build column constructors with tests
robertDurst Apr 17, 2023
b59c9fc
update readme with progress
robertDurst Apr 17, 2023
07f1568
remove relations from readme
robertDurst Apr 17, 2023
f78badf
add vcat and build_column
robertDurst Apr 22, 2023
a4619df
add values and cross join
robertDurst Apr 22, 2023
baf9f65
re-org before beginning example programs
robertDurst Apr 22, 2023
426e939
implement quizScoreFilter example program
robertDurst Apr 22, 2023
fe97e1a
implement brown jelly beans
robertDurst Apr 22, 2023
b1e98cd
fix test forbrown jelly beans
robertDurst Apr 22, 2023
05cb08d
make jelly bean test more functional like the example
robertDurst Apr 22, 2023
9090cf7
implement table encoder... good enough for now
robertDurst May 22, 2023
8449ef9
dot product example program
robertDurst May 25, 2023
7f94641
sample_rows example program
robertDurst May 25, 2023
3c6e1a6
select_rows, both overloads
robertDurst May 25, 2023
c5a8818
implement more errors
robertDurst May 25, 2023
e2e564c
fix brown get acne error test
robertDurst May 26, 2023
24c2435
add error for black and white
robertDurst May 26, 2023
c6e04c5
begin error helpers
robertDurst May 26, 2023
d2e7e86
implement mid final error
robertDurst May 26, 2023
d3639a6
update readme with progress
robertDurst May 26, 2023
988f42f
add final error programs
robertDurst May 26, 2023
944d9b7
complete the last error example program for use table
robertDurst May 26, 2023
e45fc83
update readme with progress
robertDurst May 26, 2023
60689d7
small simplification
robertDurst May 26, 2023
43f445b
implement head
robertDurst May 26, 2023
37b223d
implement drop_column(s), distinct
robertDurst May 26, 2023
8b9c9bc
move around some rubocop declarations and implement tsort
robertDurst May 26, 2023
64d7877
phacking example programs
robertDurst May 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Media/Ruby/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require:
- rubocop-rspec

AllCops:
NewCops: enable

RSpec/RepeatedDescription:
Enabled: false

RSpec/ExampleLength:
Enabled: false

RSpec/NestedGroups:
Enabled: false

RSpec/MultipleExpectations:
Enabled: false
13 changes: 13 additions & 0 deletions Media/Ruby/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

source 'https://rubygems.org'

# for the assert_ensure, assert_require hacks to display a useful error based on the source code
# used to test the assertion
gem 'ruby2ruby'

group :development, :test do
gem 'rspec'
gem 'rubocop'
gem 'rubocop-rspec'
end
63 changes: 63 additions & 0 deletions Media/Ruby/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
diff-lcs (1.5.0)
json (2.6.3)
parallel (1.22.1)
parser (3.2.2.0)
ast (~> 2.4.1)
rainbow (3.1.1)
regexp_parser (2.7.0)
rexml (3.2.5)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.1)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rubocop (1.50.1)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.2.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.28.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.17.1)
rubocop (~> 1.41)
rubocop-rspec (2.19.0)
rubocop (~> 1.33)
rubocop-capybara (~> 2.17)
ruby-progressbar (1.13.0)
ruby2ruby (2.5.0)
ruby_parser (~> 3.1)
sexp_processor (~> 4.6)
ruby_parser (3.20.0)
sexp_processor (~> 4.16)
sexp_processor (4.16.1)
unicode-display_width (2.4.2)

PLATFORMS
arm64-darwin-22
x86_64-linux

DEPENDENCIES
rspec
rubocop
rubocop-rspec
ruby2ruby

BUNDLED WITH
2.4.12
135 changes: 135 additions & 0 deletions Media/Ruby/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Ruby

**This code was written and tested with Ruby 3.2.0.**

## How to Execute Tests

If you haven't already, install gems.
```
bundle install
```

Execute tests.
```
bundle rspec .
```

***

## Table API Implementation Progress

#### Assumptions

**Functions:**

* [x] even
* [x] length
* [x] schema (lives on the table class)
* [x] range
* [x] concat
* [x] startsWith
* [x] average
* [x] filter
* [x] map
* [x] removeDuplicates
* [x] removeAll
* [x] colNameOfNumber

#### Constructors
* [x] emptyTable
* [x] addRows
* [x] addColumn
* [x] buildColumn
* [x] vcat
* [x] hcat
* [x] values
* [x] crossJoin
* [ ] leftJoin

#### Properties

* [x] nrows
* [x] ncols
* [x] header

#### Access Subcomponents

* [x] getRow
* [x] getValue
* [x] getColumn (overloading 1 & 2)

#### Subtable

* [x] selectRows (overloading 1 & 2)
* [ ] selectColumns (overloading 1 & 2 & 3)
* [x] head
* [x] distinct
* [x] dropColumn
* [x] dropColumns
* [x] tfilter

#### Ordering

* [x] tsort
* [ ] sortByColumns
* [ ] orderBy

#### Aggregate

* [x] count
* [ ] bin
* [ ] piviotTable
* [ ] groupBy

#### Missing Values

* [ ] completeCases
* [ ] dropna
* [ ] fillna

#### Data Cleaning

* [ ] pivotLonger
* [ ] pivotWider

#### Utilities

* [ ] flatten
* [ ] transformColumn
* [ ] renameColumns
* [ ] find
* [ ] groupByRetentive
* [ ] groupBySubtractive
* [ ] update
* [ ] select
* [ ] selectMany
* [ ] groupJoin
* [ ] join

### Error Programs

#### Malformed Tables

**TBD**

#### Using Tables

* [x] midFinal
* [x] blackAndWhite
* [x] pieCount
* [x] brownGetAcne
* [x] getOnlyRow
* [x] favoriteColor
* [x] brownJellyBeans
* [x] employeeToDepartment

### Example Programs

* [x] dotProduct
* [x] sampleRows
* [x] pHackingHomogeneous
* [x] pHackingHeterogenous
* [x] quizScoreFilter
* [ ] quizScoreSelect
* [ ] groupByRetentive
* [ ] groupBySubtractive
Loading