aristotle 0.2.4 → 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 +4 -4
- data/lib/aristotle/logic.rb +4 -2
- data/test/test_aristotle.rb +5 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c5830d79225ea0e3194be01b679387e502fb46d
|
4
|
+
data.tar.gz: fb9744176dd22c8038643e778ce11f5f1e64cf97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b717303ea0dce854f472e5b2c75aaafb1eb0413fe5f916719a3e533403634a3f3fab92c1133534c2ca0045750ba75dfeedbb1b996fcabf954502d8802c59e519
|
7
|
+
data.tar.gz: b3bc1fcdfa876cc8323be6a616c41669fc9eb391ed6963ab3f363befafd7098131b4aa7a4c1edf6790ae769bdfb1653699e6723fb58c84fc1ae790c0d3b0b439
|
data/lib/aristotle/logic.rb
CHANGED
@@ -4,11 +4,13 @@ module Aristotle
|
|
4
4
|
@object = object
|
5
5
|
end
|
6
6
|
|
7
|
-
def process(logic_method)
|
7
|
+
def process(logic_method, return_command: false)
|
8
8
|
self.class.commands(logic_method).each do |command|
|
9
9
|
next unless command.condition_passes_with?(@object)
|
10
10
|
|
11
|
-
|
11
|
+
return_value = command.do_action_with(@object)
|
12
|
+
|
13
|
+
return return_command ? command : return_value
|
12
14
|
end
|
13
15
|
|
14
16
|
nil
|
data/test/test_aristotle.rb
CHANGED
@@ -63,5 +63,10 @@ class AristotleTest < Minitest::Test
|
|
63
63
|
assert_equal 'payload', test_logic.process('Test payload')
|
64
64
|
|
65
65
|
assert_equal 'regexp', test_logic.process('Test condition regexp')
|
66
|
+
|
67
|
+
returned_command = test_logic.process('Test condition regexp', return_command: true)
|
68
|
+
assert returned_command.is_a?(Aristotle::Command)
|
69
|
+
assert_equal 'Return payload', returned_command.action
|
70
|
+
assert_equal 'this is a regexp condition', returned_command.condition
|
66
71
|
end
|
67
72
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aristotle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marius Andra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby business logic engine, inspired by Cucumber
|
14
14
|
email: marius@apprentus.com
|
@@ -45,7 +45,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
45
45
|
version: '0'
|
46
46
|
requirements: []
|
47
47
|
rubyforge_project:
|
48
|
-
rubygems_version: 2.
|
48
|
+
rubygems_version: 2.5.1
|
49
49
|
signing_key:
|
50
50
|
specification_version: 4
|
51
51
|
summary: Business logic
|