jdantonio/functional-ruby — pull request #18 by jdantonio (2014-08-18 22:30:13+00:00)
Title: Records can be declared with a type/protocol specification for type safety.

Unlike a Ruby `Struct`, a `Record` may be declared with a type/protocol specification. In this case, all data members are checked against the specification whenever a new record is created. Declaring a `Record` with a type specification is similar to declaring a normal `Record`, except that the field list is given as a hash with field names as the keys and a class or protocol as the values.

```ruby
Functional::SpecifyProtocol(:Name) do
attr_reader :first
attr_reader :middle
attr_reader :last
end

TypedCustomer = Functional::Record.new(name: :Name, address: String) #=> TypedCustomer

Functional::Record.new("TypedCustomer", name: :Name, address: String) #=> Functional::Record::TypedCustomer
```