rangops 1.0.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +23 -0
- data/LICENSE.txt +21 -0
- data/README.md +49 -0
- data/Rakefile +19 -0
- data/bin/console +11 -0
- data/bin/setup +8 -0
- data/docs/README_md.html +150 -0
- data/docs/Rangops/Set.html +719 -0
- data/docs/Rangops.html +105 -0
- data/docs/created.rid +3 -0
- data/docs/css/fonts.css +167 -0
- data/docs/css/rdoc.css +683 -0
- data/docs/fonts/Lato-Light.ttf +0 -0
- data/docs/fonts/Lato-LightItalic.ttf +0 -0
- data/docs/fonts/Lato-Regular.ttf +0 -0
- data/docs/fonts/Lato-RegularItalic.ttf +0 -0
- data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
- data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
- data/docs/images/add.png +0 -0
- data/docs/images/arrow_up.png +0 -0
- data/docs/images/brick.png +0 -0
- data/docs/images/brick_link.png +0 -0
- data/docs/images/bug.png +0 -0
- data/docs/images/bullet_black.png +0 -0
- data/docs/images/bullet_toggle_minus.png +0 -0
- data/docs/images/bullet_toggle_plus.png +0 -0
- data/docs/images/date.png +0 -0
- data/docs/images/delete.png +0 -0
- data/docs/images/find.png +0 -0
- data/docs/images/loadingAnimation.gif +0 -0
- data/docs/images/macFFBgHack.png +0 -0
- data/docs/images/package.png +0 -0
- data/docs/images/page_green.png +0 -0
- data/docs/images/page_white_text.png +0 -0
- data/docs/images/page_white_width.png +0 -0
- data/docs/images/plugin.png +0 -0
- data/docs/images/ruby.png +0 -0
- data/docs/images/tag_blue.png +0 -0
- data/docs/images/tag_green.png +0 -0
- data/docs/images/transparent.png +0 -0
- data/docs/images/wrench.png +0 -0
- data/docs/images/wrench_orange.png +0 -0
- data/docs/images/zoom.png +0 -0
- data/docs/index.html +159 -0
- data/docs/js/darkfish.js +120 -0
- data/docs/js/navigation.js +105 -0
- data/docs/js/navigation.js.gz +0 -0
- data/docs/js/search.js +110 -0
- data/docs/js/search_index.js +1 -0
- data/docs/js/search_index.js.gz +0 -0
- data/docs/js/searcher.js +229 -0
- data/docs/js/searcher.js.gz +0 -0
- data/docs/table_of_contents.html +190 -0
- data/lib/rangops/set.rb +183 -0
- data/lib/rangops/version.rb +3 -0
- data/lib/rangops.rb +9 -0
- data/rangops.gemspec +38 -0
- metadata +141 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 485eb7acc54d2b3bbb164eba5bb8feb7740db3a0f0fbdeeaed3f0daa8e8e0c98
|
|
4
|
+
data.tar.gz: 074c8cc3f02759af90fd9319a82126a1be621ce626cac962c061018d76d2c175
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 7386938a537baa3226be2ac6f5f504acb46778c836422a809385c56acd3508b4e4a1fef6a44d2dd30fe784a1399a036a5e0804c6c0e8f3cf47e5b62f7a43e33a
|
|
7
|
+
data.tar.gz: 8b7da51eb22ee01822246af4e7fca799d10250b4b92574fef5339b850d1e709c3dcb456a5f0a562f9af9e5b6c80a4e51f36bb650c07d439c6bba96e063b71021
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
rangops (1.0.0.beta1)
|
|
5
|
+
|
|
6
|
+
GEM
|
|
7
|
+
remote: https://rubygems.org/
|
|
8
|
+
specs:
|
|
9
|
+
minitest (5.25.5)
|
|
10
|
+
rake (13.3.0)
|
|
11
|
+
|
|
12
|
+
PLATFORMS
|
|
13
|
+
ruby
|
|
14
|
+
x86_64-linux
|
|
15
|
+
|
|
16
|
+
DEPENDENCIES
|
|
17
|
+
bundler
|
|
18
|
+
minitest
|
|
19
|
+
rake
|
|
20
|
+
rangops!
|
|
21
|
+
|
|
22
|
+
BUNDLED WITH
|
|
23
|
+
2.6.3
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Bartosz Pietraszko
|
|
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
|
+
# Rangops
|
|
2
|
+
|
|
3
|
+
Rangops is a simple Ruby extension library that aims to treat Ranges as sets.
|
|
4
|
+
|
|
5
|
+
It provides methods for elementary set related operations and predicates.
|
|
6
|
+
|
|
7
|
+
class Range
|
|
8
|
+
include Rangops::Set
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
Union:
|
|
12
|
+
|
|
13
|
+
(1..5).union(3..10)
|
|
14
|
+
=> 1..10
|
|
15
|
+
|
|
16
|
+
(11..19) | (16..23)
|
|
17
|
+
=> 11..23
|
|
18
|
+
|
|
19
|
+
Intersection:
|
|
20
|
+
|
|
21
|
+
(1..5).intersection(3..10)
|
|
22
|
+
=> 3..5
|
|
23
|
+
|
|
24
|
+
(11..19) & (16..23)
|
|
25
|
+
=> 16..19
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
Complement, difference operations and subset/superset checking is also available.
|
|
29
|
+
For full list of methods, check [API docs](https://bartpiet.github.io/rangops/).
|
|
30
|
+
|
|
31
|
+
No mapping to arrays nor iterating on elements is performed, so operations
|
|
32
|
+
on ranges of any size are possible without penalty on speed or memory usage.
|
|
33
|
+
Ranges delimited with any type of Numerics can be operated.
|
|
34
|
+
|
|
35
|
+
(1.0..10).union(Rational(20, 4)..Float::INFINITY)
|
|
36
|
+
=> 1.0..Infinity
|
|
37
|
+
|
|
38
|
+
It works equally well on string and date ranges, although some operations may be
|
|
39
|
+
not available if they only make sense for numbers.
|
|
40
|
+
|
|
41
|
+
Library tries to adhere to conventions established in Ruby core and `Set` module
|
|
42
|
+
from standard library. It only focuses on extending core Range class; only ranges or
|
|
43
|
+
elements covered by them can be used as arguments. Due to the properties of Range class,
|
|
44
|
+
most operations return meaningful results only for ranges of the same type.
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
|
|
49
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
2
|
+
require "rake/testtask"
|
|
3
|
+
require 'rdoc/task'
|
|
4
|
+
|
|
5
|
+
Rake::TestTask.new(:test) do |t|
|
|
6
|
+
t.libs << "test"
|
|
7
|
+
t.libs << "lib"
|
|
8
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
|
9
|
+
end
|
|
10
|
+
task :default => :test
|
|
11
|
+
|
|
12
|
+
RDoc::Task.new do |rdoc|
|
|
13
|
+
rdoc.main = 'README.md'
|
|
14
|
+
rdoc.rdoc_files.include('README.md', 'lib/rangops/set.rb')
|
|
15
|
+
rdoc.rdoc_dir = 'docs'
|
|
16
|
+
rdoc.title = 'Rangops'
|
|
17
|
+
rdoc.markup = 'markdown'
|
|
18
|
+
end
|
|
19
|
+
|
data/bin/console
ADDED
data/bin/setup
ADDED
data/docs/README_md.html
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
|
|
3
|
+
<html lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
|
|
8
|
+
<title>README - Rangops</title>
|
|
9
|
+
|
|
10
|
+
<meta name="keywords" content="ruby,documentation,README">
|
|
11
|
+
<meta name="description" content="README: Rangops Rangops is a simple Ruby extension library that aims to treat Ranges as sets. It provides methods for elementary set related operations and p">
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
<script type="text/javascript">
|
|
15
|
+
var rdoc_rel_prefix = "./";
|
|
16
|
+
var index_rel_prefix = "./";
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<script src="./js/navigation.js" defer></script>
|
|
20
|
+
<script src="./js/search.js" defer></script>
|
|
21
|
+
<script src="./js/search_index.js" defer></script>
|
|
22
|
+
<script src="./js/searcher.js" defer></script>
|
|
23
|
+
<script src="./js/darkfish.js" defer></script>
|
|
24
|
+
|
|
25
|
+
<link href="./css/fonts.css" rel="stylesheet">
|
|
26
|
+
<link href="./css/rdoc.css" rel="stylesheet">
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
<body id="top" role="document" class="file">
|
|
30
|
+
<div id="navigation-toggle" role="button" tabindex="0" aria-label="Toggle sidebar" aria-expanded="true" aria-controls="navigation">
|
|
31
|
+
<span aria-hidden="true">☰</span>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
<nav id="navigation" role="navigation">
|
|
36
|
+
<div id="project-navigation">
|
|
37
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
|
38
|
+
<h2>
|
|
39
|
+
<a href="./index.html" rel="home">Home</a>
|
|
40
|
+
</h2>
|
|
41
|
+
|
|
42
|
+
<div id="table-of-contents-navigation">
|
|
43
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
|
44
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
|
45
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
|
50
|
+
<form action="#" method="get" accept-charset="utf-8">
|
|
51
|
+
<div id="search-field-wrapper">
|
|
52
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
|
53
|
+
aria-autocomplete="list" aria-controls="search-results"
|
|
54
|
+
type="text" name="search" placeholder="Search (/) for a class, method, ..." spellcheck="false"
|
|
55
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<ul id="search-results" aria-label="Search Results"
|
|
59
|
+
aria-busy="false" aria-expanded="false"
|
|
60
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
|
61
|
+
</form>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
<div class="nav-section">
|
|
68
|
+
<h3>Table of Contents</h3>
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
<ul class="link-list" role="directory">
|
|
73
|
+
<li>
|
|
74
|
+
<details open>
|
|
75
|
+
<summary> <a href="#label-Rangops">Rangops</a>
|
|
76
|
+
</summary>
|
|
77
|
+
<ul class="link-list" role="directory">
|
|
78
|
+
<li> <a href="#label-License">License</a>
|
|
79
|
+
|
|
80
|
+
</ul>
|
|
81
|
+
</details>
|
|
82
|
+
</li>
|
|
83
|
+
|
|
84
|
+
</ul>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
<div id="fileindex-section" class="nav-section">
|
|
89
|
+
<h3>Pages</h3>
|
|
90
|
+
|
|
91
|
+
<ul class="link-list">
|
|
92
|
+
<li><a href="./README_md.html">README</a>
|
|
93
|
+
</ul>
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
<footer id="validator-badges" role="contentinfo">
|
|
98
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
|
99
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.14.2.
|
|
100
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
|
101
|
+
</footer>
|
|
102
|
+
|
|
103
|
+
</nav>
|
|
104
|
+
|
|
105
|
+
<main role="main" aria-label="Page README.md">
|
|
106
|
+
|
|
107
|
+
<h1 id="label-Rangops"><a href="Rangops.html"><code>Rangops</code></a><span><a href="#label-Rangops">¶</a> <a href="#top">↑</a></span></h1>
|
|
108
|
+
|
|
109
|
+
<p><a href="Rangops.html"><code>Rangops</code></a> is a simple Ruby extension library that aims to treat Ranges as sets.</p>
|
|
110
|
+
|
|
111
|
+
<p>It provides methods for elementary set related operations and predicates.</p>
|
|
112
|
+
|
|
113
|
+
<pre class="ruby"> <span class="ruby-keyword">class</span> <span class="ruby-constant">Range</span>
|
|
114
|
+
<span class="ruby-identifier">include</span> <span class="ruby-constant">Rangops</span><span class="ruby-operator">::</span><span class="ruby-constant">Set</span>
|
|
115
|
+
<span class="ruby-keyword">end</span>
|
|
116
|
+
</pre>
|
|
117
|
+
|
|
118
|
+
<p>Union:</p>
|
|
119
|
+
|
|
120
|
+
<pre> (1..5).union(3..10)
|
|
121
|
+
=> 1..10
|
|
122
|
+
|
|
123
|
+
(11..19) | (16..23)
|
|
124
|
+
=> 11..23</pre>
|
|
125
|
+
|
|
126
|
+
<p>Intersection:</p>
|
|
127
|
+
|
|
128
|
+
<pre> (1..5).intersection(3..10)
|
|
129
|
+
=> 3..5
|
|
130
|
+
|
|
131
|
+
(11..19) & (16..23)
|
|
132
|
+
=> 16..19</pre>
|
|
133
|
+
|
|
134
|
+
<p>Complement, difference operations and subset/superset checking is also available. For full list of methods, check <a href="https://bartpiet.github.io/rangops/">API docs</a>.</p>
|
|
135
|
+
|
|
136
|
+
<p>No mapping to arrays nor iterating on elements is performed, so operations on ranges of any size are possible without penalty on speed or memory usage. Ranges delimited with any type of Numerics can be operated.</p>
|
|
137
|
+
|
|
138
|
+
<pre> (1.0..10).union(Rational(20, 4)..Float::INFINITY)
|
|
139
|
+
=> 1.0..Infinity</pre>
|
|
140
|
+
|
|
141
|
+
<p>It works equally well on string and date ranges, although some operations may be not available if they only make sense for numbers.</p>
|
|
142
|
+
|
|
143
|
+
<p>Library tries to adhere to conventions established in Ruby core and <code>Set</code> module from standard library. It only focuses on extending core Range class; only ranges or elements covered by them can be used as arguments. Due to the properties of Range class, most operations return meaningful results only for ranges of the same type.</p>
|
|
144
|
+
|
|
145
|
+
<h2 id="label-License">License<span><a href="#label-License">¶</a> <a href="#top">↑</a></span></h2>
|
|
146
|
+
|
|
147
|
+
<p>The gem is available as open source under the terms of the <a href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
|
|
148
|
+
|
|
149
|
+
</main>
|
|
150
|
+
|