splay_tree 0.2.0 → 0.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c66b504221015b64dc0e1ea92bfe583eb279a9e3
4
- data.tar.gz: d7a06439164029d713e38135ffff5786435675aa
2
+ SHA256:
3
+ metadata.gz: 7db3333f96bcd04b3f7766c56b55b450adf0005f8f6e89f3502e7d741bf39e53
4
+ data.tar.gz: 6af03f7dc28f3fde8921cfc16d3a45836e867103934ef63309dbee2937896936
5
5
  SHA512:
6
- metadata.gz: 074fe40542d0b6665e01a8dc5a31b2efe7402676c5d7e78cb95a30da616e146cd83801d9f5a401cc76bf90cf7a29c2f1adf36f9c6b1c33a433aff3c720189ef7
7
- data.tar.gz: 4f0d1375ef8aed9e1d30fc632a3fe1e44eb3f4765f4411314de5fd6eaf8e6df7a9fc896494ce16b3152a4d35f9901a64690c539189791b52c3dd57238797b64f
6
+ metadata.gz: 25ab7c5a533c1e9408d14b88851361093d33c43389823933474607b80a615adf2e7970bf2a021278597b53856a6d72e68324e1f1a051939d6284ecd4f3a00006
7
+ data.tar.gz: 801cecc487afd61c56cab1edfa94cbe3f95b40903e8b95941879c6974a1b6bf12250a7fa988c5c9a17d74eeba44229af2058cd8589ac12a87deeae76cd071d1c
@@ -1,5 +1,21 @@
1
- 0.2.0 (January 3, 2015)
1
+ # Change log
2
+
3
+ ## [v0.3.0] - 2019-02-26
4
+
5
+ * Change to limit to Ruby >= 2.0.0
6
+ * Change gemspec to load files directly without git
7
+ * Change to freeze all strings
8
+
9
+ ## [v0.2.0] - 2015-01-03
2
10
 
3
11
  * Add ability to set default through value and block
4
12
  * Add ability to iterate over keys and values
5
13
  * Add to_hash export
14
+
15
+ ## [v0.1.0] - 2014-12-27
16
+
17
+ * Initial implementation and release
18
+
19
+ [v0.3.0]: https://github.com/piotrmurach/splay_tree/compare/v0.2.0...v0.3.0
20
+ [v0.2.0]: https://github.com/piotrmurach/splay_tree/compare/v0.1.0...v0.2.0
21
+ [v0.1.0]: https://github.com/piotrmurach/splay_tree/compare/v0.1.0
data/README.md CHANGED
@@ -1,15 +1,18 @@
1
1
  # SplayTree
2
- [![Gem Version](https://badge.fury.io/rb/splay_tree.png)][gem]
3
- [![Build Status](https://secure.travis-ci.org/peter-murach/splay_tree.png?branch=master)][travis]
4
- [![Code Climate](https://codeclimate.com/github/peter-murach/splay_tree.png)][codeclimate]
5
- [![Coverage Status](https://coveralls.io/repos/peter-murach/splay_tree/badge.png)][coverage]
6
- [![Inline docs](http://inch-ci.org/github/peter-murach/splay_tree.png)][inchpages]
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/splay_tree.svg)][gem]
4
+ [![Build Status](https://secure.travis-ci.org/piotrmurach/splay_tree.svg?branch=master)][travis]
5
+ [![Build status](https://ci.appveyor.com/api/projects/status/smfi5r38ihtn9gom?svg=true)][appveyor]
6
+ [![Maintainability](https://api.codeclimate.com/v1/badges/32d2351f6c349a58d8da/maintainability)][codeclimate]
7
+ [![Coverage Status](https://coveralls.io/repos/github/piotrmurach/splay_tree/badge.svg?branch=master)][coverage]
8
+ [![Inline docs](http://inch-ci.org/github/piotrmurach/splay_tree.svg)][inchpages]
7
9
 
8
10
  [gem]: http://badge.fury.io/rb/splay_tree
9
- [travis]: http://travis-ci.org/peter-murach/splay_tree
10
- [codeclimate]: https://codeclimate.com/github/peter-murach/splay_tree
11
- [coverage]: https://coveralls.io/r/peter-murach/splay_tree
12
- [inchpages]: http://inch-ci.org/github/peter-murach/splay_tree
11
+ [travis]: http://travis-ci.org/piotrmurach/splay_tree
12
+ [appveyor]: https://ci.appveyor.com/project/piotrmurach/splay-tree
13
+ [codeclimate]: https://codeclimate.com/github/piotrmurach/splay_tree/maintainability
14
+ [coverage]: https://coveralls.io/github/piotrmurach/splay_tree
15
+ [inchpages]: http://inch-ci.org/github/piotrmurach/splay_tree
13
16
 
14
17
  > Self balancing binary tree that keeps lookup operations fast by optimizing frequently accessed keys. Useful for implementing caches and garbage collection algorithms.
15
18
 
@@ -152,7 +155,7 @@ If no block is provided, an enumerator is returned instead.
152
155
 
153
156
  ## Contributing
154
157
 
155
- 1. Fork it ( https://github.com/peter-murach/splay_tree/fork )
158
+ 1. Fork it ( https://github.com/piotrmurach/splay_tree/fork )
156
159
  2. Create your feature branch (`git checkout -b my-new-feature`)
157
160
  3. Commit your changes (`git commit -am 'Add some feature'`)
158
161
  4. Push to the branch (`git push origin my-new-feature`)
@@ -160,4 +163,4 @@ If no block is provided, an enumerator is returned instead.
160
163
 
161
164
  ## Copyright
162
165
 
163
- Copyright (c) 2014-2015 Piotr Murach. See LICENSE for further details.
166
+ Copyright (c) 2014 Piotr Murach. See LICENSE for further details.
data/Rakefile CHANGED
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require "bundler/gem_tasks"
4
2
 
5
3
  FileList['tasks/**/*.rake'].each(&method(:import))
@@ -1,9 +1,10 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'benchmark/ips'
4
- require 'splay_tree'
5
4
  require 'securerandom'
6
5
 
6
+ require_relative '../lib/splay_tree'
7
+
7
8
  def generate_key(size)
8
9
  SecureRandom.hex(size)
9
10
  end
@@ -1,7 +1,7 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
- require 'splay_tree/node'
4
- require 'splay_tree/version'
3
+ require_relative 'splay_tree/node'
4
+ require_relative 'splay_tree/version'
5
5
 
6
6
  class SplayTree
7
7
  include Enumerable
@@ -26,10 +26,10 @@ class SplayTree
26
26
  # @api public
27
27
  def initialize(default = UndefinedValue, &block)
28
28
  if !UndefinedValue.equal?(default) && block
29
- fail ArgumentError,
30
- 'You need to pas seither argument or a block as a default value'
29
+ raise ArgumentError,
30
+ "You need to pass either argument or a block as a default value"
31
31
  end
32
- @root = Node::EMPTY
32
+ @root = Node::EMPTY
33
33
  @subtree = Node.new(nil, nil)
34
34
  @default = default
35
35
  @default_proc = block
@@ -44,7 +44,7 @@ class SplayTree
44
44
  def size
45
45
  @root.size
46
46
  end
47
- alias_method :length, :size
47
+ alias length size
48
48
 
49
49
  # Iterate over each key & value pair in the tree
50
50
  #
@@ -153,7 +153,7 @@ class SplayTree
153
153
 
154
154
  splay(key)
155
155
  end
156
- alias_method :insert, :[]=
156
+ alias insert []=
157
157
 
158
158
  # Find object by the key
159
159
  #
@@ -168,7 +168,7 @@ class SplayTree
168
168
 
169
169
  @root.value
170
170
  end
171
- alias_method :fetch, :[]
171
+ alias fetch []
172
172
 
173
173
  # Check if tree contains a node with a matching key.
174
174
  #
@@ -177,6 +177,7 @@ class SplayTree
177
177
  # @api public
178
178
  def key?(key)
179
179
  return false if @root.empty?
180
+
180
181
  splay(key)
181
182
  @root.key == key
182
183
  end
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  class SplayTree
4
4
  # A single tree node representation
@@ -1,5 +1,5 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  class SplayTree
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
  end # SplayTree
@@ -1,6 +1,6 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
- if RUBY_VERSION > '1.9' and (ENV['COVERAGE'] || ENV['TRAVIS'])
3
+ if ENV['COVERAGE'] || ENV['TRAVIS']
4
4
  require 'simplecov'
5
5
  require 'coveralls'
6
6
 
@@ -1,4 +1,3 @@
1
- # coding: utf-8
2
1
  lib = File.expand_path('../lib', __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'splay_tree/version'
@@ -7,16 +6,20 @@ Gem::Specification.new do |spec|
7
6
  spec.name = "splay_tree"
8
7
  spec.version = SplayTree::VERSION
9
8
  spec.authors = ["Piotr Murach"]
10
- spec.email = [""]
9
+ spec.email = ["me@piotrmurach.com"]
11
10
  spec.summary = %q{A self-balancing binary tree with amortized access.}
12
11
  spec.description = %q{Self balancing binary tree that keeps lookup operations fast by optimizing frequently accessed keys. Useful for implementing caches and garbage collection algorithms.}
13
- spec.homepage = "https://github.com/peter-murach/splay_tree"
12
+ spec.homepage = "https://github.com/piotrmurach/splay_tree"
14
13
  spec.license = "MIT"
15
14
 
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
+ spec.files = Dir['{lib,spec,benchmarks}/**/*.rb']
16
+ spec.files += Dir['tasks/*', 'splay_tree.gemspec']
17
+ spec.files += Dir['README.md', 'CHANGELOG.md', 'LICENSE.txt', 'Rakefile']
19
18
  spec.require_paths = ["lib"]
20
19
 
21
- spec.add_development_dependency "bundler", "~> 1.5"
20
+ spec.required_ruby_version = '>= 2.0.0'
21
+
22
+ spec.add_development_dependency "bundler", ">= 1.5"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "rspec", "~> 3.0"
22
25
  end
metadata CHANGED
@@ -1,44 +1,67 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: splay_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Murach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-03 00:00:00.000000000 Z
11
+ date: 2019-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.5'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
27
55
  description: Self balancing binary tree that keeps lookup operations fast by optimizing
28
56
  frequently accessed keys. Useful for implementing caches and garbage collection
29
57
  algorithms.
30
58
  email:
31
- - ''
59
+ - me@piotrmurach.com
32
60
  executables: []
33
61
  extensions: []
34
62
  extra_rdoc_files: []
35
63
  files:
36
- - .gitignore
37
- - .rspec
38
- - .ruby-version
39
- - .travis.yml
40
64
  - CHANGELOG.md
41
- - Gemfile
42
65
  - LICENSE.txt
43
66
  - README.md
44
67
  - Rakefile
@@ -58,7 +81,7 @@ files:
58
81
  - tasks/console.rake
59
82
  - tasks/coverage.rake
60
83
  - tasks/spec.rake
61
- homepage: https://github.com/peter-murach/splay_tree
84
+ homepage: https://github.com/piotrmurach/splay_tree
62
85
  licenses:
63
86
  - MIT
64
87
  metadata: {}
@@ -68,27 +91,18 @@ require_paths:
68
91
  - lib
69
92
  required_ruby_version: !ruby/object:Gem::Requirement
70
93
  requirements:
71
- - - '>='
94
+ - - ">="
72
95
  - !ruby/object:Gem::Version
73
- version: '0'
96
+ version: 2.0.0
74
97
  required_rubygems_version: !ruby/object:Gem::Requirement
75
98
  requirements:
76
- - - '>='
99
+ - - ">="
77
100
  - !ruby/object:Gem::Version
78
101
  version: '0'
79
102
  requirements: []
80
103
  rubyforge_project:
81
- rubygems_version: 2.0.3
104
+ rubygems_version: 2.7.3
82
105
  signing_key:
83
106
  specification_version: 4
84
107
  summary: A self-balancing binary tree with amortized access.
85
- test_files:
86
- - spec/spec_helper.rb
87
- - spec/unit/default_spec.rb
88
- - spec/unit/delete_spec.rb
89
- - spec/unit/each_spec.rb
90
- - spec/unit/fetch_spec.rb
91
- - spec/unit/insert_spec.rb
92
- - spec/unit/new_spec.rb
93
- - spec/unit/to_hash_spec.rb
94
- has_rdoc:
108
+ test_files: []
data/.gitignore DELETED
@@ -1,14 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --color
2
- --require spec_helper
3
- --warnings
@@ -1 +0,0 @@
1
- 2.0.0
@@ -1,22 +0,0 @@
1
- language: ruby
2
- bundler_args: --without yard benchmarks
3
- script: "bundle exec rake ci"
4
- rvm:
5
- - 1.9.3
6
- - 2.0.0
7
- - 2.1.0
8
- - 2.2.0
9
- - ruby-head
10
- matrix:
11
- include:
12
- - rvm: jruby-19mode
13
- - rvm: jruby-20mode
14
- - rvm: jruby-21mode
15
- - rvm: jruby-head
16
- - rvm: rbx-2
17
- allow_failures:
18
- - rvm: ruby-head
19
- - rvm: jruby-head
20
- fast_finish: true
21
- branches:
22
- only: master
data/Gemfile DELETED
@@ -1,17 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- group :development do
6
- gem 'rake', '~> 10.3.2'
7
- gem 'rspec', '~> 3.1.0'
8
- gem 'yard', '~> 0.8.7'
9
- gem 'timecop', '~> 0.7.1'
10
- gem 'benchmark-ips', '~> 2.0.0'
11
- end
12
-
13
- group :metrics do
14
- gem 'coveralls', '~> 0.7.0'
15
- gem 'simplecov', '~> 0.8.2'
16
- gem 'yardstick', '~> 0.9.9'
17
- end