range_dsl 0.1.0 → 0.1.1
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.
- data/README.rdoc +55 -1
- data/VERSION +1 -1
- data/lib/range_dsl.rb +6 -0
- data/range_dsl.gemspec +60 -0
- metadata +5 -4
data/README.rdoc
CHANGED
@@ -1,6 +1,60 @@
|
|
1
1
|
= range_dsl
|
2
2
|
|
3
|
-
|
3
|
+
range_dsl provides easy open range and ranges with complex conditions
|
4
|
+
|
5
|
+
== example
|
6
|
+
You can write these code in class which includes RangeDsl or
|
7
|
+
in object extend RangeDsl.
|
8
|
+
|
9
|
+
Now use it in irb.
|
10
|
+
$ irb
|
11
|
+
require 'rubygems'
|
12
|
+
require 'range_dsl'
|
13
|
+
include RangeDsl
|
14
|
+
|
15
|
+
For example, with greater_than_equal
|
16
|
+
gte(3).include?(1) # => false
|
17
|
+
gte(3).include?(3) # => true
|
18
|
+
gte(3).include?(4) # => true
|
19
|
+
|
20
|
+
with greater_than
|
21
|
+
gt(3).include?(1) # => false
|
22
|
+
gt(3).include?(3) # => false
|
23
|
+
gt(3).include?(4) # => true
|
24
|
+
|
25
|
+
You can use these operators:
|
26
|
+
* gte, greater_than_equal
|
27
|
+
* gt , greater_than
|
28
|
+
* lte, less_than_equal
|
29
|
+
* lt , less_than
|
30
|
+
* eq , equal
|
31
|
+
* neq, not_equal
|
32
|
+
* not_be
|
33
|
+
|
34
|
+
And can use connection operator
|
35
|
+
* &, and
|
36
|
+
* |, or
|
37
|
+
* all
|
38
|
+
* any
|
39
|
+
|
40
|
+
For example, you can write "1, 2, or greater than equal 5" like following:
|
41
|
+
r = any(1, 2, gte(5))
|
42
|
+
r.include?(0) # => false
|
43
|
+
r.include?(1) # => true
|
44
|
+
r.include?(2) # => true
|
45
|
+
r.include?(3) # => false
|
46
|
+
r.include?(4) # => false
|
47
|
+
r.include?(5) # => true
|
48
|
+
|
49
|
+
Or you can write it like this:
|
50
|
+
r = any(1, 2) | gte(5)
|
51
|
+
r.include?(0) # => false
|
52
|
+
r.include?(1) # => true
|
53
|
+
r.include?(2) # => true
|
54
|
+
r.include?(3) # => false
|
55
|
+
r.include?(4) # => false
|
56
|
+
r.include?(5) # => true
|
57
|
+
|
4
58
|
|
5
59
|
== Note on Patches/Pull Requests
|
6
60
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/range_dsl.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
module RangeDsl
|
2
3
|
|
3
4
|
autoload :OpenRangeExp, 'range_dsl/open_range_exp'
|
@@ -49,3 +50,8 @@ module RangeDsl
|
|
49
50
|
end
|
50
51
|
|
51
52
|
end
|
53
|
+
|
54
|
+
# irbはオッケーなのに、rails cで使ったら activesupport-3.0.0/lib/active_support/core_ext/module/introspection.rb
|
55
|
+
# あたりで"NameError: uninitialized constant RangeDsl::FilterExp::Invert::ConnectionExp"というエラーになるので、
|
56
|
+
# 回避するために先にrequireしておきます。
|
57
|
+
require 'range_dsl/connection_exp'
|
data/range_dsl.gemspec
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{range_dsl}
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["akimatter"]
|
12
|
+
s.date = %q{2010-09-19}
|
13
|
+
s.description = %q{range_dsl provides easy open range and ranges with complex conditions}
|
14
|
+
s.email = %q{akm2000@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"lib/range_dsl.rb",
|
27
|
+
"lib/range_dsl/connection_exp.rb",
|
28
|
+
"lib/range_dsl/container_exp.rb",
|
29
|
+
"lib/range_dsl/exact_exp.rb",
|
30
|
+
"lib/range_dsl/filter_exp.rb",
|
31
|
+
"lib/range_dsl/open_range_exp.rb",
|
32
|
+
"range_dsl.gemspec",
|
33
|
+
"spec/range_dsl_spec.rb",
|
34
|
+
"spec/spec.opts",
|
35
|
+
"spec/spec_helper.rb"
|
36
|
+
]
|
37
|
+
s.homepage = %q{http://github.com/akm/range_dsl}
|
38
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
39
|
+
s.require_paths = ["lib"]
|
40
|
+
s.rubygems_version = %q{1.3.7}
|
41
|
+
s.summary = %q{range_dsl provides easy open range and ranges with complex conditions}
|
42
|
+
s.test_files = [
|
43
|
+
"spec/range_dsl_spec.rb",
|
44
|
+
"spec/spec_helper.rb"
|
45
|
+
]
|
46
|
+
|
47
|
+
if s.respond_to? :specification_version then
|
48
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
49
|
+
s.specification_version = 3
|
50
|
+
|
51
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
52
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
53
|
+
else
|
54
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
55
|
+
end
|
56
|
+
else
|
57
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: range_dsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- akimatter
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-19 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- lib/range_dsl/exact_exp.rb
|
57
57
|
- lib/range_dsl/filter_exp.rb
|
58
58
|
- lib/range_dsl/open_range_exp.rb
|
59
|
+
- range_dsl.gemspec
|
59
60
|
- spec/range_dsl_spec.rb
|
60
61
|
- spec/spec.opts
|
61
62
|
- spec/spec_helper.rb
|