borel 0.3.4 → 0.4.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0a103a33e79f18299ce5153dbfde44acabac24fe
4
+ data.tar.gz: 7723990250221d1084db8d74c27f79a71296b739
5
+ SHA512:
6
+ metadata.gz: abb376784ea3a9e1b2f2e691f8c9bd4b113abe0f973104ed44361116851069a69ab014aa148b323ba26885f7584182e095e5b2a6cd158f505ce038375b69a99d
7
+ data.tar.gz: d36bbc7b73a75d1fc69555924603c05a6401c307b65cc7bcaed66eb9c58edb23094a9114a8cc0b177bb4c1cbb8a8554f1b31ac0a88998a28bea5e6abedf6249b
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  pkg
2
2
  Gemfile.lock
3
+ coverage
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0
4
+ - 2.1
5
+ - 2.2
6
+ - 2.3.0
7
+ before_install:
8
+ - gem install bundler
9
+ script: SPEC_OPTS="-cf doc" bundle exec rake spec
10
+ notifications:
11
+ irc:
12
+ channels:
13
+ - "irc.freenode.org#borel"
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ 0.4.0
4
+ -----
5
+
6
+ - Test against Ruby 2.0, 2.1, 2.2, 2.3
7
+ - Fix intersection between points and intervals [#1](https://github.com/badosu/borel/pull/1) -- [@giovannibonetti](https://github.com/giovannibonetti)
data/Gemfile CHANGED
@@ -2,10 +2,11 @@ source "http://www.rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- group :development do
6
- gem 'rspec', '~> 2.8.0'
7
- gem 'guard-rspec', '~> 0.7.0'
8
- gem 'yard', '~> 0.7.5'
9
- gem 'redcarpet'
10
- gem 'fivemat'
5
+ group :development, :test do
6
+ gem 'rake'
7
+ gem 'rspec', '~> 2'
8
+ end
9
+
10
+ group :test do
11
+ gem 'coveralls', require: false
11
12
  end
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  Borel
2
2
  =====
3
3
 
4
+ [![Build Status](https://travis-ci.org/badosu/borel.png)](https://travis-ci.org/badosu/borel) [![Gem Version](https://badge.fury.io/rb/borel.png)](http://badge.fury.io/rb/borel) [![Code Climate](https://codeclimate.com/github/badosu/borel.png)](https://codeclimate.com/github/badosu/borel)
5
+
4
6
  Borelian sets are formed by enumerable union, intersection or
5
7
  complement, of intervals.
6
8
 
@@ -146,7 +148,20 @@ Interval[1,5].rand # -> Random.new.rand 1..5
146
148
  Interval[1,5].width # -> 5-1, only for simple intervals
147
149
  ```
148
150
 
149
- It's supported only for `Numeric`, `Comparable` and arithmetic supported classes
151
+ It's supported only for `Numeric`, `Comparable` and arithmetic supported
152
+ classes
153
+
154
+ Implementations
155
+ ---------------
156
+
157
+ The following engines and versions are continuosly tested:
158
+
159
+ * MRI 1.9.3
160
+ * MRI 2.0.0
161
+ * Latest jRuby Stable
162
+ * Latest Rubinius Stable
163
+
164
+ MRI 1.8.7 has limited supported with some patches
150
165
 
151
166
  Remarks
152
167
  -------
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
- task_file_pattern = File.expand_path("../tasks/**/*.rb", __FILE__)
1
+ task_file_pattern = File.expand_path("../lib/tasks/**/*.rb", __FILE__)
2
2
  Dir[task_file_pattern].each do |task_file|
3
3
  require File.expand_path(task_file)
4
4
  end
5
5
 
6
- task :default => [ :rspec ]
6
+ require 'bundler/gem_tasks'
7
+
8
+ task :default => [ :spec ]
@@ -71,12 +71,6 @@ class Interval
71
71
  Interval.union(other.to_interval, self)
72
72
  end
73
73
 
74
- # @return [Interval]
75
- def intersect(other)
76
- other.to_interval.map{|y| map{|x| x.intersect(y)}}.
77
- flatten.reduce(:union) || Interval[]
78
- end
79
-
80
74
  # @return [Interval]
81
75
  def complement
82
76
  map{|x| x.to_interval.map(&:complement).reduce(:intersect)}.
@@ -21,7 +21,9 @@ class Interval::Simple < Interval
21
21
 
22
22
  # @return [Interval]
23
23
  def intersect(other)
24
- Interval[[inf, other.inf].max, [sup, other.sup].min]
24
+ other.map{ |component|
25
+ Interval[[inf, component.inf].max, [sup, component.sup].min]
26
+ }.reduce(:union) || Interval[]
25
27
  end
26
28
 
27
29
  # @return [Interval::Multiple]
@@ -3,9 +3,9 @@ module Borel
3
3
  # Major version number
4
4
  MAJOR = 0
5
5
  # Minor version number
6
- MINOR = 3
6
+ MINOR = 4
7
7
  # Tiny version number
8
- TINY = 4
8
+ TINY = 0
9
9
 
10
10
  # Joins the version numbers
11
11
  VERSION = [MAJOR, MINOR, TINY].join('.')
@@ -0,0 +1,9 @@
1
+ desc "Validate the gemspec"
2
+ task :gemspec do
3
+ eval(File.read("borel.gemspec")).validate
4
+ end
5
+
6
+ desc "Launches interactive console with borel"
7
+ task console: :install do
8
+ system "irb -r borel"
9
+ end
File without changes
@@ -1,3 +1,4 @@
1
+ require 'spec_helper'
1
2
  require 'borel/interval'
2
3
  require 'borel/array.rb'
3
4
 
@@ -1,3 +1,4 @@
1
+ require 'spec_helper'
1
2
  require 'borel/interval'
2
3
 
3
4
  describe Interval::Multiple do
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+ require 'borel/interval'
3
+
4
+ describe Interval::Simple do
5
+ context "#intersect" do
6
+ specify "[1,2]; [[1], [2]] -> [[1], [2]]" do
7
+ x = Interval[[1, 2]]
8
+ y = Interval[[1], [2]]
9
+ x.intersect(y).should eq y
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,4 @@
1
+ require 'spec_helper'
1
2
  require 'borel/interval'
2
3
 
3
4
  describe Interval do
@@ -1,3 +1,4 @@
1
+ require 'spec_helper'
1
2
  require 'borel/math_extensions/interval_arithmetic'
2
3
 
3
4
  describe Borel::IntervalArithmetic do
@@ -1,3 +1,4 @@
1
+ require 'spec_helper'
1
2
  require 'borel/math_extensions/randomizable'
2
3
 
3
4
  describe Borel::Randomizable do
@@ -11,7 +12,7 @@ describe Borel::Randomizable do
11
12
 
12
13
  context '#random' do
13
14
  let(:interval){ Interval[1,10] }
14
- let(:rand_mock) { mock }
15
+ let(:rand_mock) { double }
15
16
 
16
17
  it 'should be a point inside the interval' do
17
18
  interval.should include interval.rand
@@ -1,3 +1,4 @@
1
+ require 'spec_helper'
1
2
  require 'borel/math_extensions'
2
3
 
3
4
  describe "Intervals Math Extensions" do
@@ -1,3 +1,4 @@
1
+ require 'spec_helper'
1
2
  require 'borel/interval'
2
3
  require 'borel/nil_class.rb'
3
4
 
@@ -1,3 +1,4 @@
1
+ require 'spec_helper'
1
2
  require 'borel/interval'
2
3
  require 'borel/numeric'
3
4
 
@@ -1,3 +1,4 @@
1
+ require 'spec_helper'
1
2
  require 'borel/interval'
2
3
  require 'borel/range'
3
4
 
@@ -0,0 +1,8 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+
4
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
5
+ SimpleCov.start do
6
+ add_filter "spec"
7
+ add_filter "lib/borel/version"
8
+ end
metadata CHANGED
@@ -1,28 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: borel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
5
- prerelease:
4
+ version: 0.4.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Amadeus Folego
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-24 00:00:00.000000000 Z
11
+ date: 2016-07-29 00:00:00.000000000 Z
13
12
  dependencies: []
14
- description: ! 'Borel sets are made of enumerable union and intersection of
15
-
13
+ description: |-
14
+ Borel sets are made of enumerable union and intersection of
16
15
  intervals. Borel performs regular operations on intervals of any
17
-
18
- Comparable class.'
16
+ Comparable class.
19
17
  email:
20
18
  - amadeusfolego@gmail.com
21
19
  executables: []
22
20
  extensions: []
23
21
  extra_rdoc_files: []
24
22
  files:
25
- - .gitignore
23
+ - ".gitignore"
24
+ - ".travis.yml"
25
+ - Changes.md
26
26
  - Gemfile
27
27
  - Guardfile
28
28
  - LICENSE
@@ -42,8 +42,11 @@ files:
42
42
  - lib/borel/numeric.rb
43
43
  - lib/borel/range.rb
44
44
  - lib/borel/version.rb
45
+ - lib/tasks/gem.rb
46
+ - lib/tasks/rspec.rb
45
47
  - spec/array_spec.rb
46
48
  - spec/interval_multiple_spec.rb
49
+ - spec/interval_simple_spec.rb
47
50
  - spec/interval_spec.rb
48
51
  - spec/math_extensions/interval_arithmetic_spec.rb
49
52
  - spec/math_extensions/randomizable_spec.rb
@@ -51,31 +54,28 @@ files:
51
54
  - spec/nil_class_spec.rb
52
55
  - spec/numeric_spec.rb
53
56
  - spec/range_spec.rb
54
- - tasks/gem.rb
55
- - tasks/rspec.rb
57
+ - spec/spec_helper.rb
56
58
  homepage: http://github.com/badosu/borel
57
59
  licenses: []
60
+ metadata: {}
58
61
  post_install_message:
59
62
  rdoc_options: []
60
63
  require_paths:
61
64
  - lib
62
65
  required_ruby_version: !ruby/object:Gem::Requirement
63
- none: false
64
66
  requirements:
65
- - - ! '>='
67
+ - - ">="
66
68
  - !ruby/object:Gem::Version
67
69
  version: 1.9.2
68
70
  required_rubygems_version: !ruby/object:Gem::Requirement
69
- none: false
70
71
  requirements:
71
- - - ! '>='
72
+ - - ">="
72
73
  - !ruby/object:Gem::Version
73
74
  version: 1.3.6
74
75
  requirements: []
75
76
  rubyforge_project: borel
76
- rubygems_version: 1.8.25
77
+ rubygems_version: 2.5.1
77
78
  signing_key:
78
- specification_version: 3
79
+ specification_version: 4
79
80
  summary: Interval operation on Comparable classes
80
81
  test_files: []
81
- has_rdoc:
@@ -1,28 +0,0 @@
1
- gemspec = eval(File.read("borel.gemspec"))
2
-
3
- desc "Validate the gemspec"
4
- task :gemspec do
5
- gemspec.validate
6
- end
7
-
8
- desc "Build gem locally"
9
- task :build => :gemspec do
10
- system "gem build #{gemspec.name}.gemspec"
11
- FileUtils.mkdir_p "pkg"
12
- FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", "pkg"
13
- end
14
-
15
- desc "Install gem locally"
16
- task :install => :build do
17
- system "gem install pkg/#{gemspec.name}-#{gemspec.version}"
18
- end
19
-
20
- desc "Launches interactive console with borel"
21
- task :console => :install do
22
- system "irb -r #{gemspec.name}"
23
- end
24
-
25
- desc "Clean automatically generated files"
26
- task :clean do
27
- FileUtils.rm_rf "pkg"
28
- end