<commit_before># Typetanic

**All the goodness of dedicated value objects ready to go**

Typetanic defines a collection of ruby value objects that occur across many types of applications. The collection is growing, included so far are:

- [email](https://github.com/CrowdHailer/typtanic#user-content-email)

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'typetanic', :require => false
```

And then execute:

```
$ bundle
```

Or install it yourself as:

```
$ gem install typetanic
```

## Usage

It is recommended NOT to require the whole of typetanic. It is unlikely all the types will be relevant. It is also recommended to subclass each type to a namespace appropriate to your domain. This has several benefits.

- Extensions can be made without monkey patching the library class.
- The typetanic version can be swapped out with minimal knock on effect.
- The subclass can have a more appropriate name.

*email_address.rb*
```rb
require 'typetanic/email'

class EmailAddress < Typetanic::Email
  # Any custom code to extend the email class can be added here.
  # For example querying if the email address is local to the company.

  def internal?
    hostname == 'workshop14.io'
  end
end
```

## Included Types

### Email

Represents email addresses.
- Initialization strips leading and trailing whitespace
- It is an invalid email without and '@' symbol
- It is also invalid with more than one '@''symbol
<commit_msg>add blog link<commit_after># Typetanic

**All the goodness of dedicated value objects ready to go**

Typetanic defines a collection of ruby value objects that occur across many types of applications. The collection is growing, included so far are:

- [email](https://github.com/CrowdHailer/typtanic#user-content-email)

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'typetanic', :require => false
```

And then execute:

```
$ bundle
```

Or install it yourself as:

```
$ gem install typetanic
```

## Usage

It is recommended NOT to require the whole of typetanic. It is unlikely all the types will be relevant. It is also recommended to subclass each type to a namespace appropriate to your domain*. This has several benefits.

- Extensions can be made without monkey patching the library class.
- The typetanic version can be swapped out with minimal knock on effect.
- The subclass can have a more appropriate name.

*This is why all types are in the Typetanic namespace, see this [post](http://insights.workshop14.io/2015/05/28/ruby-require-and-broad-modules.html) for more details*

*email_address.rb*
```rb
require 'typetanic/email'

class EmailAddress < Typetanic::Email
  # Any custom code to extend the email class can be added here.
  # For example querying if the email address is local to the company.

  def internal?
    hostname == 'workshop14.io'
  end
end
```

## Included Types

### Email

Represents email addresses.
- Initialization strips leading and trailing whitespace
- It is an invalid email without and '@' symbol
- It is also invalid with more than one '@''symbol

{'fraction_non_alphanumeric': 0.07869918699186992, 'fraction_numerical': 0.0045528455284552845, 'mean_word_length': 4.187183811129848, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '4341811', 'n_tokens_mistral': 899, 'n_tokens_neox': 836, 'n_words': 410}