rivescript 0.1.1 → 0.1.2

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: 14789bd36c582ca744be88d8b762b3cf847ead692646caa8f107c911069b1ad5
4
- data.tar.gz: da1e1ec25b54649951f4e426da08b895884b3e5753d3961e22cb3ac6da867da9
3
+ metadata.gz: 6cf48d3dc6eeff70e0698b9a7b42c8a9c921636586c561b9eb098af62ca0171e
4
+ data.tar.gz: 296f35bbfbea76b22e4646b3a6a642be7b5da10acaaef69d440e98807a1e9588
5
5
  SHA512:
6
- metadata.gz: b9744e1364266843b4b18a6ae8319fa24e9eec7969c7ed2e3fb3fc2811ab044720de93a0cd83054b50d8ad77c1d0d14e55efc6c19b603340cf100e9060ef4d26
7
- data.tar.gz: a536b6e990beac8a900c35f65c00033870cad0f64b5b0ddc66d2d0ac9c49c8a156dafb4de05ef7b936975a9b33ac9888eea971036c56d10783dfd2b31d7a4219
6
+ metadata.gz: bf6a55bfcb6193c483447edcd18d2c6f71e756b1932848c86c8458c30d86955e56b3d892fcf215a18d3c003d0313e38350eecebef98b1d11ad9cfc8667a1d579
7
+ data.tar.gz: 3487acdf944f1ed82b2cd6fc013a199733bd401ca5ccf621adbb9f86cdbd5aa3ea0c701e34d3416180465093e0498264a6e0c97b58c2c92b82ce967c36c58dc1
data/Changes.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changes
2
2
 
3
+ ## 0.1.2
4
+
5
+ - Preserve `%previous` context when a turn returns `ERR: No Reply Matched`
6
+ or `ERR: No Reply Found` (do not overwrite `history.reply[0]`)
7
+ - Add `eg/previous` demo for `%previous` surviving unmatched replies
8
+
3
9
  ## 0.1.1
4
10
 
5
11
  - Ship the sample brain (`eg/brain`) inside the gem
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # RiveScript-RB
1
+ # RiveScript-rb
2
2
 
3
3
  A [RiveScript](https://www.rivescript.com/) interpreter for Ruby 3.3+.
4
4
 
@@ -17,7 +17,7 @@ implementation.
17
17
  Add to your `Gemfile`:
18
18
 
19
19
  ```ruby
20
- gem "rivescript", "~> 0.1.1"
20
+ gem "rivescript", "~> 0.1.2"
21
21
  ```
22
22
 
23
23
  Then:
@@ -57,13 +57,13 @@ riveshell
57
57
  # Gemfile (development / unreleased tip)
58
58
  gem "rivescript",
59
59
  git: "https://github.com/LilOleByte/rivescript-rb.git",
60
- tag: "v0.1.1"
60
+ tag: "v0.1.2"
61
61
  ```
62
62
 
63
63
  ```bash
64
64
  bundle install
65
- bundle exec rake package # builds pkg/rivescript-0.1.1.gem + verifies contents
66
- gem install --user-install pkg/rivescript-0.1.1.gem
65
+ bundle exec rake package # builds pkg/rivescript-0.1.2.gem + verifies contents
66
+ gem install --user-install pkg/rivescript-0.1.2.gem
67
67
  ```
68
68
 
69
69
  ## Usage
@@ -265,8 +265,13 @@ class RiveScript
265
265
  begin
266
266
  history["input"].pop
267
267
  history["input"].unshift(msg)
268
- history["reply"].pop
269
- history["reply"].unshift(reply)
268
+ # Keep %previous intact when nothing matched / no reply was found.
269
+ # Otherwise ERR strings overwrite history.reply[0] and short
270
+ # conversations cannot continue (aichaos/rivescript-js#411).
271
+ unless error_reply?(reply)
272
+ history["reply"].pop
273
+ history["reply"].unshift(reply)
274
+ end
270
275
  rescue StandardError
271
276
  history = new_history
272
277
  end
@@ -982,5 +987,10 @@ class RiveScript
982
987
  "reply" => Array.new(10, "undefined")
983
988
  }
984
989
  end
990
+
991
+ def error_reply?(reply)
992
+ reply == @master.errors["replyNotMatched"] ||
993
+ reply == @master.errors["replyNotFound"]
994
+ end
985
995
  end
986
996
  end
@@ -5,5 +5,5 @@
5
5
  # MIT License
6
6
 
7
7
  class RiveScript
8
- VERSION = "0.1.1"
8
+ VERSION = "0.1.2"
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rivescript
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Byte