<commit_before># Values

[![Gem Version](https://img.shields.io/gem/v/values.svg)](https://rubygems.org/gems/values/)
[![Gem Downloads](https://img.shields.io/gem/dt/values.svg)](https://rubygems.org/gems/values/)
[![CI Build Status](https://img.shields.io/travis/tcrayford/Values.svg)](https://travis-ci.org/tcrayford/Values)
[![Code Coverage](https://img.shields.io/codecov/c/github/tcrayford/Values.svg)](https://codecov.io/github/tcrayford/Values)
[![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/tcrayford/Values/master/frames)

## Summary

Values is a tiny library for creating value objects in ruby.

Classes created using {Value} mostly look like classes created using
[Struct](http://ruby-doc.org/core-2.2.1/Struct.html) or
[OpenStruct](http://ruby-doc.org/stdlib-2.2.1/libdoc/ostruct/rdoc/OpenStruct.html),
but fix two problems with those:

## Problems with [Struct](http://ruby-doc.org/core-2.2.1/Struct.html) and [OpenStruct](http://ruby-doc.org/stdlib-2.2.1/libdoc/ostruct/rdoc/OpenStruct.html)

Struct and OpenStruct constructors can take less than the default number of arguments and set other fields as nil:

```ruby
Point = Struct.new(:x, :y)
Point.new(1)
# => #<struct Point x=1, y=nil>
```

```ruby
p = OpenStruct.new(x: 1)<commit_msg>Bah, use github link instead of yard link<commit_after># Values

[![Gem Version](https://img.shields.io/gem/v/values.svg)](https://rubygems.org/gems/values/)
[![Gem Downloads](https://img.shields.io/gem/dt/values.svg)](https://rubygems.org/gems/values/)
[![CI Build Status](https://img.shields.io/travis/tcrayford/Values.svg)](https://travis-ci.org/tcrayford/Values)
[![Code Coverage](https://img.shields.io/codecov/c/github/tcrayford/Values.svg)](https://codecov.io/github/tcrayford/Values)
[![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/tcrayford/Values/master/frames)

## Summary

Values is a tiny library for creating value objects in ruby.

Classes created using [Value](lib/values.rb) mostly look like classes created using
[Struct](http://ruby-doc.org/core-2.2.1/Struct.html) or
[OpenStruct](http://ruby-doc.org/stdlib-2.2.1/libdoc/ostruct/rdoc/OpenStruct.html),
but fix two problems with those:

## Problems with [Struct](http://ruby-doc.org/core-2.2.1/Struct.html) and [OpenStruct](http://ruby-doc.org/stdlib-2.2.1/libdoc/ostruct/rdoc/OpenStruct.html)

Struct and OpenStruct constructors can take less than the default number of arguments and set other fields as nil:

```ruby
Point = Struct.new(:x, :y)
Point.new(1)
# => #<struct Point x=1, y=nil>
```

```ruby
p = OpenStruct.new(x: 1)
{'fraction_non_alphanumeric': 0.18647930117736422, 'fraction_numerical': 0.01139384732244588, 'mean_word_length': 4.8533333333333335, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1901637', 'n_tokens_mistral': 999, 'n_tokens_neox': 942, 'n_words': 168}