natter 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/natter/entity.rb +10 -4
- data/lib/natter/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13f97d6f2534d07f6f183f0bbd8a11ef49bab3a8
|
4
|
+
data.tar.gz: 7ff275a13e6e7aa256abb16f2a148f2c510b465a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2eb357fc794b72db7015fdf2a8411184b03480cb94370e4a43aa4688c6d4bad64a8cc2869d69c71aacc9bbb7fa083ec0f6161647dd44ca4a624436be4bb08446
|
7
|
+
data.tar.gz: ff00c69847b2a7c05d691840b35082fcd2e2f8abf808d6a3db71aa35b48dfa7f2841eb8165127f346c02a6cdc526f568fb365f907f584053ccfc4f874fd026d3
|
data/lib/natter/entity.rb
CHANGED
@@ -2,13 +2,12 @@ module Natter
|
|
2
2
|
# Public: An entity is an attribute of an intent.
|
3
3
|
class Entity
|
4
4
|
attr_accessor :name, :type
|
5
|
-
attr_reader :value
|
6
5
|
|
7
6
|
# Public: Constructor.
|
8
7
|
#
|
9
8
|
# name - Must be unique within an individual intent.
|
10
9
|
# type - One of the pre-defined EntityType constants (default: 'generic')
|
11
|
-
# value - Will never be nil when generated by the parser but may be nil
|
10
|
+
# value - Will never be nil when generated by the parser but may be nil
|
12
11
|
# for some rule definitions (default: nil).
|
13
12
|
def initialize(name, type = EntityType::GENERIC, value = nil)
|
14
13
|
@name = name
|
@@ -16,8 +15,15 @@ module Natter
|
|
16
15
|
@value = value
|
17
16
|
end
|
18
17
|
|
18
|
+
# Public: Set this entity's value.
|
19
|
+
#
|
20
|
+
# value - The new value.
|
21
|
+
def value=(v)
|
22
|
+
@value = v
|
23
|
+
end
|
24
|
+
|
19
25
|
# Public: Returns the value of this entity.
|
20
|
-
# If @type is `generic` then we just return @value, otherwise we will need
|
26
|
+
# If @type is `generic` then we just return @value, otherwise we will need
|
21
27
|
# to verify/compute the value to return.
|
22
28
|
#
|
23
29
|
# Returns object or nil (if invalid @value)
|
@@ -37,4 +43,4 @@ module Natter
|
|
37
43
|
GENERIC = 'generic'
|
38
44
|
TIME = 'time'
|
39
45
|
end
|
40
|
-
end
|
46
|
+
end
|
data/lib/natter/version.rb
CHANGED