taipu 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7a67d23e561796ad3d9cc1de9181aa66b5ad7177
4
+ data.tar.gz: 0804a2e12fa022ee9b92517d17170f5677d828ba
5
+ SHA512:
6
+ metadata.gz: ebb20472837838ef628bd78b521343ebf0e5f82646004f543238c61bba02ace0ade937d92d8f5c0405e6a36f6f64f07bdceeeaa4b184b7572a0a15f5a4bd4240
7
+ data.tar.gz: d5649e71940f355fcb87417c70e6a9191dd31facc8ebe935b956841541c5ad9b15e1afae94affa1d23df3d2be32d6fc411bd7ca79c330051a308f35ebefd9157
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,15 @@
1
+ language: ruby
2
+ sudo: false
3
+ cache: bundler
4
+ script: 'bundle exec rake test:coverage --trace'
5
+ before_install:
6
+ - gem install bundler
7
+ rvm:
8
+ - 1.9.3
9
+ - 2.0
10
+ - 2.1
11
+ - 2.2
12
+ - ruby-head
13
+ - jruby
14
+ - jruby-head
15
+ - rbx-2
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ - README.md
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.mv ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Cyril Wack
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # Taipu
2
+
3
+ [![Build Status](https://travis-ci.org/cyril/taipu.svg?branch=master)](https://travis-ci.org/cyril/taipu)
4
+ [![Dependency Status](https://gemnasium.com/cyril/taipu.svg)](https://gemnasium.com/cyril/taipu)
5
+ [![Gem Version](http://img.shields.io/gem/v/taipu.svg)](https://rubygems.org/gems/taipu)
6
+ [![Inline docs](http://inch-ci.org/github/cyril/taipu.svg?branch=master)](http://inch-ci.org/github/cyril/taipu)
7
+ [![Documentation](http://img.shields.io/:yard-docs-38c800.svg)](http://rubydoc.info/gems/taipu/frames)
8
+
9
+ > taipuation library with some built-in matchers for Ruby.
10
+
11
+ ## Contact
12
+
13
+ * Home page: https://github.com/cyril/taipu
14
+ * Bugs/issues: https://github.com/cyril/taipu/issues
15
+ * Support: https://stackoverflow.com/questions/tagged/taipu
16
+
17
+ ## Rubies
18
+
19
+ * [MRI](https://www.ruby-lang.org/)
20
+ * [Rubinius](http://rubini.us/)
21
+ * [JRuby](http://jruby.org/)
22
+
23
+ ## Installation
24
+
25
+ Add this line to your application's Gemfile:
26
+
27
+ ```ruby
28
+ gem 'taipu'
29
+ ```
30
+
31
+ And then execute:
32
+
33
+ $ bundle
34
+
35
+ Or install it yourself as:
36
+
37
+ $ gem install taipu
38
+
39
+ ## Versioning
40
+
41
+ __Taipu__ follows [Semantic Versioning 2.0](http://semver.org/).
42
+
43
+ ## Contributing
44
+
45
+ 1. [Fork it](https://github.com/cyril/taipu/fork)
46
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
47
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
48
+ 4. Push to the branch (`git push origin my-new-feature`)
49
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,18 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.pattern = File.join 'test', '**', 'test_*.rb'
6
+ t.verbose = true
7
+ t.warning = true
8
+ end
9
+
10
+ namespace :test do
11
+ task :coverage do
12
+ ENV['COVERAGE'] = 'true'
13
+ Rake::Task['test'].invoke
14
+ end
15
+ end
16
+
17
+ task(:doc_stats) { ruby '-S yard stats' }
18
+ task default: [:test, :doc_stats]
data/VERSION.semver ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/bin/console ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'taipu'
5
+
6
+ require 'irb'
7
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
data/lib/taipu.rb ADDED
@@ -0,0 +1,6 @@
1
+ Dir[File.join File.dirname(__FILE__), 'taipu', '*.rb'].each do |filename|
2
+ require_relative filename
3
+ end
4
+
5
+ module Taipu
6
+ end
@@ -0,0 +1,8 @@
1
+ require_relative 'base'
2
+
3
+ # Namespace for the Taipu library.
4
+ module Taipu
5
+ # The type number.
6
+ class Array < Base
7
+ end
8
+ end
data/lib/taipu/base.rb ADDED
@@ -0,0 +1,23 @@
1
+ # Namespace for the Taipu library.
2
+ module Taipu
3
+ # Abstract class.
4
+ class Base
5
+ def initialize(*)
6
+ freeze
7
+ end
8
+
9
+ def to_h
10
+ {
11
+ type: to_sym
12
+ }.merge(constraints)
13
+ end
14
+
15
+ def to_sym
16
+ self.class.name.split('::').last.downcase.to_sym
17
+ end
18
+
19
+ def constraints
20
+ {}
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,8 @@
1
+ require_relative 'base'
2
+
3
+ # Namespace for the Taipu library.
4
+ module Taipu
5
+ # The type boolean.
6
+ class Boolean < Base
7
+ end
8
+ end
data/lib/taipu/hash.rb ADDED
@@ -0,0 +1,8 @@
1
+ require_relative 'base'
2
+
3
+ # Namespace for the Taipu library.
4
+ module Taipu
5
+ # The type number.
6
+ class Hash < Base
7
+ end
8
+ end
@@ -0,0 +1,27 @@
1
+ require_relative 'base'
2
+
3
+ # Namespace for the Taipu library.
4
+ module Taipu
5
+ # The type number.
6
+ class Number < Base
7
+ def initialize( min: nil,
8
+ max: nil )
9
+
10
+ if !min.nil? && !max.nil?
11
+ fail 'MinIsGreaterThanMaxError' if min > max
12
+ end
13
+
14
+ @min = min
15
+ @max = max
16
+
17
+ freeze
18
+ end
19
+
20
+ def constraints
21
+ {
22
+ min: @min,
23
+ max: @max
24
+ }
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,30 @@
1
+ require_relative 'base'
2
+
3
+ # Namespace for the Taipu library.
4
+ module Taipu
5
+ # The type string.
6
+ class String < Base
7
+ def initialize( minlen: nil,
8
+ maxlen: nil,
9
+ pattern: nil )
10
+
11
+ if !minlen.nil? && !maxlen.nil?
12
+ fail 'MinlenIsLongerThanMaxlenError' if minlen > maxlen
13
+ end
14
+
15
+ @minlen = minlen
16
+ @maxlen = maxlen
17
+ @pattern = pattern
18
+
19
+ freeze
20
+ end
21
+
22
+ def constraints
23
+ {
24
+ minlen: @minlen,
25
+ maxlen: @maxlen,
26
+ pattern: @pattern
27
+ }
28
+ end
29
+ end
30
+ end
data/taipu.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = 'taipu'
3
+ spec.version = File.read('VERSION.semver')
4
+ spec.authors = ['Cyril Wack']
5
+ spec.email = ['contact@cyril.email']
6
+
7
+ spec.summary = 'Collections of types.'
8
+ spec.description = 'Collections of types for Ruby.'
9
+ spec.homepage = 'https://github.com/cyril/taipu'
10
+ spec.license = 'MIT'
11
+
12
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(/^test\//) }
13
+ spec.executables = spec.files.grep(/^exe\//) { |f| File.basename(f) }
14
+ spec.require_paths = ['lib']
15
+
16
+ spec.add_development_dependency 'bundler', '~> 1.8'
17
+ spec.add_development_dependency 'rake', '~> 10.0'
18
+ spec.add_development_dependency 'yard', '~> 0.8'
19
+ spec.add_development_dependency 'simplecov', '~> 0.9.1'
20
+ spec.add_development_dependency 'rubocop', '~> 0.29'
21
+ end
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: taipu
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Cyril Wack
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: yard
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.8'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.8'
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.9.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.9.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.29'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.29'
83
+ description: Collections of types for Ruby.
84
+ email:
85
+ - contact@cyril.email
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".travis.yml"
92
+ - ".yardopts"
93
+ - CODE_OF_CONDUCT.md
94
+ - Gemfile
95
+ - LICENSE.mv
96
+ - README.md
97
+ - Rakefile
98
+ - VERSION.semver
99
+ - bin/console
100
+ - bin/setup
101
+ - lib/taipu.rb
102
+ - lib/taipu/array.rb
103
+ - lib/taipu/base.rb
104
+ - lib/taipu/boolean.rb
105
+ - lib/taipu/hash.rb
106
+ - lib/taipu/number.rb
107
+ - lib/taipu/string.rb
108
+ - taipu.gemspec
109
+ homepage: https://github.com/cyril/taipu
110
+ licenses:
111
+ - MIT
112
+ metadata: {}
113
+ post_install_message:
114
+ rdoc_options: []
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ requirements: []
128
+ rubyforge_project:
129
+ rubygems_version: 2.4.5
130
+ signing_key:
131
+ specification_version: 4
132
+ summary: Collections of types.
133
+ test_files: []
134
+ has_rdoc: