dartsclone 0.3.0 → 0.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1da00e4a34b27cfb6c92d84becee7272ae1750435162fc54569ac56eac480e3a
4
- data.tar.gz: b4eef44bc5a1bed3e90a2feb672583042c06c663546753867281f470f16a8295
3
+ metadata.gz: 0de9241630b790fea0794afe5ec48d7ac7335faae7c9d563ce42cdfe47670f43
4
+ data.tar.gz: 66dd871d41f3ba849c949093c02b6ac4613541e8ad81e062255a771955ec0988
5
5
  SHA512:
6
- metadata.gz: 1a56790440c9bbd25ade6b59b5998d5201e119e92750afc659bc673c652e127d2edb19700de238ab6f03edc9e7272c300a7a995b49157ca952347c7ed1017e8b
7
- data.tar.gz: 542dc9c97512fc29b2cfb54366370aca0105c724aa6f1a230071615a07667e1e2956089b966241fc936cfafa1faf6e1d6defe105c788e4fe1e30ead7a77993d4
6
+ metadata.gz: 3f696063913884d67ebdd20b51b4d49363537650c831b28d9a987d808d9cb3e239eeec95e2e0b4fed67ab94925ca37649383b4ff956e37141f9c12b3cd79ef33
7
+ data.tar.gz: f5ffe5cc13ee5560e258ecbb0ead2a14b0b96b09d7f286317d1514f5b01eb1dcca12fa1bd15dedb594bd5393eaa51c9e49ddc28ac2b4f87eba599fc8f181f505
@@ -12,11 +12,9 @@ jobs:
12
12
  steps:
13
13
  - uses: actions/checkout@v2
14
14
  - name: Set up Ruby ${{ matrix.ruby }}
15
- uses: actions/setup-ruby@v1
15
+ uses: ruby/setup-ruby@v1
16
16
  with:
17
17
  ruby-version: ${{ matrix.ruby }}
18
+ bundler-cache: true
18
19
  - name: Build and test with Rake
19
- run: |
20
- gem install --no-document bundler
21
- bundle install --jobs 4 --retry 3
22
- bundle exec rake
20
+ run: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.3.1
2
+ - Add dummy constructor call at memory allocation of binding class to prevent occuring segment fault on GC when initialize method is failed.
3
+
1
4
  ## 0.3.0
2
5
  - Add type declaration file: sig/dartsclone.rbs
3
6
 
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![Gem Version](https://badge.fury.io/rb/dartsclone.svg)](https://badge.fury.io/rb/dartsclone)
5
5
  [![BSD 2-Clause License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg)](https://github.com/yoshoku/darts-clone.rb/blob/main/LICENSE.txt)
6
6
 
7
- Darts-clone.rb is a Ruby binding for the [Darts-clone](https://github.com/s-yata/darts-clone).
7
+ Darts-clone.rb provides Ruby bindings for the [Darts-clone](https://github.com/s-yata/darts-clone).
8
8
 
9
9
  ## Installation
10
10
 
data/dartsclone.gemspec CHANGED
@@ -6,8 +6,8 @@ Gem::Specification.new do |spec|
6
6
  spec.authors = ['yoshoku']
7
7
  spec.email = ['yoshoku@outlook.com']
8
8
 
9
- spec.summary = 'Ruby binding for the Darts-clone.'
10
- spec.description = 'Darts-clone.rb is a Ruby binding for the Darts-clone.'
9
+ spec.summary = 'Ruby bindings for the Darts-clone.'
10
+ spec.description = 'Darts-clone.rb provides Ruby bindings for the Darts-clone.'
11
11
  spec.homepage = 'https://github.com/yoshoku/darts-clone.rb'
12
12
  spec.license = 'BSD-2-Clause'
13
13
 
@@ -11,6 +11,7 @@ class RbDoubleArray
11
11
  public:
12
12
  static VALUE double_array_alloc(VALUE self) {
13
13
  Darts::DoubleArray* ptr = (Darts::DoubleArray*)ruby_xmalloc(sizeof(Darts::DoubleArray));
14
+ new (ptr) Darts::DoubleArray(); // dummy call to constructor for GC.
14
15
  return TypedData_Wrap_Struct(self, &double_array_type, ptr);
15
16
  };
16
17
 
@@ -0,0 +1,93 @@
1
+ # This class is for yard.
2
+
3
+ # Darts-clone.rb is a Ruby binding for the Darts-clone.
4
+ module DartsClone
5
+ # The version of Darts-clone.rb you are using.
6
+ VERSION = '0.2.2'
7
+
8
+ # The version of Darts-clone that this gem is binding to.
9
+ DARTS_CLONE_VERSION = '0.32'
10
+
11
+ # DoubleArray is a class that implements double-array trie.
12
+ #
13
+ # @example
14
+ # require 'dartsclone'
15
+ #
16
+ # da = DartsClone::DoubleArray.new
17
+ #
18
+ # keys = ['abc', 'abcd', 'abcde', 'bcd', 'cde']
19
+ # da.build(keys)
20
+ #
21
+ # p da.common_prefix_search('abcde')
22
+ # # => [["abc", "abcd", "abcde"], [0, 1, 2]]
23
+ #
24
+ class DoubleArray
25
+ # Create a new double-array trie.
26
+ def initialize; end
27
+
28
+ # Build index of double-array trie
29
+ #
30
+ # @param keys [Array<String>]
31
+ # @param values [Array<Integer>]
32
+ # @return [Boolean]
33
+ def build(keys, values: nil); end
34
+
35
+ # Open saved index.
36
+ #
37
+ # @param filename [String]
38
+ # @return [Boolean]
39
+ def open(filename); end
40
+
41
+ # Save index.
42
+ #
43
+ # @param filename [String]
44
+ # @param mode [String]
45
+ # @param offset [Integer]
46
+ # @return [Boolean]
47
+ def save(filename, mode: 'wb', offset: 0); end
48
+
49
+ # Dump array data.
50
+ #
51
+ # @return [String]
52
+ def get_array(); end
53
+
54
+ # Load array data.
55
+ #
56
+ # @param str [String]
57
+ def set_array(str); end
58
+
59
+ # Search with exact match
60
+ #
61
+ # @param key [String]
62
+ # @param length [Integer]
63
+ # @param node_pos [Integer]
64
+ def exact_match_search(key, length: 0, node_pos: 0); end
65
+
66
+ # Common prefix search.
67
+ #
68
+ # @param key [String]
69
+ def common_prefix_search(key, max_num_results: nil, length: 0, node_pos: 0); end
70
+
71
+ # Traverse trie.
72
+ #
73
+ # @param key [String]
74
+ def traverse(key, node_pos: nil, key_pos: nil, length: nil); end
75
+
76
+ # size
77
+ # @return [Integer]
78
+ def unit_size(); end
79
+
80
+ # unit size
81
+ # @return [Integer]
82
+ def size(); end
83
+
84
+ # total size
85
+ # @return [Integer]
86
+ def total_size(); end
87
+
88
+ # clear trie
89
+ # @return [Nil]
90
+ def clear(); end
91
+ end
92
+ end
93
+
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DartsClone
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  DARTS_CLONE_VERSION = '0.32'
6
6
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dartsclone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshoku
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-29 00:00:00.000000000 Z
11
+ date: 2021-08-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Darts-clone.rb is a Ruby binding for the Darts-clone.
13
+ description: Darts-clone.rb provides Ruby bindings for the Darts-clone.
14
14
  email:
15
15
  - yoshoku@outlook.com
16
16
  executables: []
@@ -31,6 +31,7 @@ files:
31
31
  - dartsclone.gemspec
32
32
  - ext/dartsclone/dartscloneext.cpp
33
33
  - ext/dartsclone/dartscloneext.hpp
34
+ - ext/dartsclone/dummy.rb
34
35
  - ext/dartsclone/extconf.rb
35
36
  - ext/dartsclone/src/COPYING.md
36
37
  - ext/dartsclone/src/darts.h
@@ -45,7 +46,7 @@ metadata:
45
46
  source_code_uri: https://github.com/yoshoku/darts-clone.rb
46
47
  changelog_uri: https://github.com/yoshoku/darts-clone.rb/blob/master/CHANGELOG.md
47
48
  documentation_uri: https://github.com/yoshoku/darts-clone.rb#usage
48
- post_install_message:
49
+ post_install_message:
49
50
  rdoc_options: []
50
51
  require_paths:
51
52
  - lib
@@ -60,8 +61,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
61
  - !ruby/object:Gem::Version
61
62
  version: '0'
62
63
  requirements: []
63
- rubygems_version: 3.1.6
64
- signing_key:
64
+ rubygems_version: 3.2.22
65
+ signing_key:
65
66
  specification_version: 4
66
- summary: Ruby binding for the Darts-clone.
67
+ summary: Ruby bindings for the Darts-clone.
67
68
  test_files: []