Homogeneous Array
Ruby
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
lib
test
.gitignore
.travis.yml
Gemfile
MIT-LICENSE
README.md
Rakefile
family.gemspec

README.md

family

Build Status Gem Version Dependency Status

Description

Homogeneous Array

Features

  • The condition is not bound by "types" ... :)

Usage

To use

require 'family'

Simplify

list = Family.new Integer
list << 7      #=> 7
list << 1.0    #=> Exception
list << 1      #=> 1
list.inspect   #=> "Integer ===: [7, 1]

Not bound by "Type"

list = Family.new /\A\S+\z/
list << 'a b c' #=> Exception
list << 'abc'   #=> "abc"
list.inspect    #=> "/\A\S+\z/ ===: ["abc"]"

HighLayer Definition

list = Family.define { AND(Float, 3..6) }
list << 4       #=> Exception
list << 2.0     #=> Exception
list << 4.0     #=> 4.0
list.inspect    #=> a Proc ===: [4.0]

Requirements

Installation

$ gem install family

Link

License

The MIT X11 License
Copyright (c) 2012 Kenichi Kamiya
See MIT-LICENSE for further details.