<commit_before>
# RStruct
### Syntactical Sugar for the Everyday Rubyist

* Built on OpenStruct
* Give persistant properties to variables!
* Made for Redis

OpenStruct is a data type in ruby that gives variables infinite setter and getter methods. 

```
require 'ostruct'

icecream = OpenStruct.new()

icecream.flavor = 'strawberry'

icecream.flavor # => "strawberry"

```

##### RStruct makes this persistant

RStruct saves OpenStruct-like data structures in Redis:

```
require 'rstruct'

$redis = Redis.new(:host => '0.0.0.0', :port => '6379')

doggy = RStruct.new($redis)

doggy.breed = 'poodle'

doggy.breed # => "poodle"

$redis.get "rstruct:70346137426160:breed" # => "poodle"

```

##### Much simpler than vanilla redis

`doggy.breed`

vs

`redis.get('doggy-breed')`


##### Initialize with a hash

Just like with OpenStructs, you can make new RStructs with a hash:

```	
book_plan = { color: 'blue', pages: 365 }

book = RStruct.new(book_plan, $redis)

book.color # => 'blue'

```

##### Customizable Database Keys

The full parameters of RStruct.new() are as follows: 

```
RStruct.new(hash=nil, prefix = 'rstruct', suffix = nil, database)<commit_msg>Updated Readme once more<commit_after>
# RStruct
### Syntactical Sugar for the Everyday Rubyist

* Built on OpenStruct
* Give persistant properties to variables!
* Made for Redis

OpenStruct is a data type in ruby that gives variables infinite setter and getter methods. 

```
require 'ostruct'

icecream = OpenStruct.new()

icecream.flavor = 'strawberry'

icecream.flavor # => "strawberry"

```

##### RStruct makes this persistant

RStruct saves OpenStruct-like data structures in Redis:

```
require 'rstruct'

$redis = Redis.new(:host => '0.0.0.0', :port => '6379')

doggy = RStruct.new($redis)

doggy.breed = 'poodle'

doggy.breed # => "poodle"

$redis.get "rstruct:70346137426160:breed" # => "poodle"

```

##### Much simpler than vanilla redis

```
doggy.breed```

vs

```
redis.get('doggy-breed')
```


##### Initialize with a hash

Just like with OpenStructs, you can make new RStructs with a hash:

```	
book_plan = { color: 'blue', pages: 365 }

book = RStruct.new(book_plan, $redis)

book.color # => 'blue'

```

##### Customizable Database Keys

The full parameters of RStruct.new() are as follows: 

```
RStruct.new(hash=nil, prefix = 'rstruct', suffix = nil, database)
{'fraction_non_alphanumeric': 0.14505119453924914, 'fraction_numerical': 0.021331058020477817, 'mean_word_length': 4.517647058823529, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3239187', 'n_tokens_mistral': 896, 'n_tokens_neox': 830, 'n_words': 242}