attentive 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/attentive.gemspec +1 -0
- data/lib/attentive/listener_collection.rb +2 -0
- data/lib/attentive/message.rb +6 -5
- data/lib/attentive/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83c00c687fb2775e98c9241f3d5b50cfeda1f081
|
4
|
+
data.tar.gz: 160136973d7d6f3a6b3c661a0f91259a2b719a4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4b1788cecb43890e207c919be1061cff04a894035e4fa343bf6b66302d54b8cd20e97b86e384e2626519821e539a34511f27a28c968ad0766330dfaa4166950
|
7
|
+
data.tar.gz: 76a8fa1d38d9a6800b07f2fa72fbe47589b1186a87ca779de832627c64edde5c3be48f8dbb013087ba128f5168f826252f0aff915c897bccdbb1353055f4ac7f
|
data/attentive.gemspec
CHANGED
@@ -21,6 +21,8 @@ module Attentive
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def hear(message)
|
24
|
+
message = Attentive::Message.new(message) unless message.is_a?(Attentive::Message)
|
25
|
+
|
24
26
|
listeners = select { |listener| listener.matches_context?(message) }
|
25
27
|
|
26
28
|
# Listen for any known phrase, starting with any token in the message.
|
data/lib/attentive/message.rb
CHANGED
@@ -3,13 +3,14 @@ require "attentive/tokenizer"
|
|
3
3
|
|
4
4
|
module Attentive
|
5
5
|
class Message
|
6
|
-
attr_reader :contexts, :text
|
6
|
+
attr_reader :contexts, :text, :original_message
|
7
7
|
|
8
|
-
def initialize(
|
9
|
-
|
10
|
-
@text =
|
8
|
+
def initialize(original_message, params={})
|
9
|
+
@original_message = original_message
|
10
|
+
@text = original_message.to_s
|
11
11
|
@contexts = Set.new(params.fetch(:contexts, []))
|
12
|
-
contexts << :conversation if tokens.grep(Attentive::Tokens::Invocation).any?
|
12
|
+
@contexts << :conversation if tokens.grep(Attentive::Tokens::Invocation).any?
|
13
|
+
@contexts += Array(original_message.contexts) if original_message.respond_to?(:contexts)
|
13
14
|
end
|
14
15
|
|
15
16
|
def tokens
|
data/lib/attentive/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attentive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Lail
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thread_safe
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rr
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
139
153
|
description:
|
140
154
|
email:
|
141
155
|
- bob.lailfamily@gmail.com
|