aristotle 0.2.4 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ecef008d88036f496e3eba275aeeb9a92157398
4
- data.tar.gz: 9a9dad10ce4581c1bac64defbbe077afe8a65e0e
3
+ metadata.gz: 4c5830d79225ea0e3194be01b679387e502fb46d
4
+ data.tar.gz: fb9744176dd22c8038643e778ce11f5f1e64cf97
5
5
  SHA512:
6
- metadata.gz: e7739ed346740804bb205cd5a0a09871946f262568c337ba6f0ba453ac3a884bc3475b59276919136793ec3475fd67b7223e3357d752f21501a8cc0cbdce0af4
7
- data.tar.gz: e0188e27f2a0b7e4b65bb93ccd0bb168ccac20e8c1550cc7fd6d0090220d6d0d329f010f42b8e87d8f6d9308ddbf9171113e5f5711ca6c4d7435903db02eec4c
6
+ metadata.gz: b717303ea0dce854f472e5b2c75aaafb1eb0413fe5f916719a3e533403634a3f3fab92c1133534c2ca0045750ba75dfeedbb1b996fcabf954502d8802c59e519
7
+ data.tar.gz: b3bc1fcdfa876cc8323be6a616c41669fc9eb391ed6963ab3f363befafd7098131b4aa7a4c1edf6790ae769bdfb1653699e6723fb58c84fc1ae790c0d3b0b439
@@ -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
- return command.do_action_with(@object)
11
+ return_value = command.do_action_with(@object)
12
+
13
+ return return_command ? command : return_value
12
14
  end
13
15
 
14
16
  nil
@@ -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.2.4
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: 2014-11-25 00:00:00.000000000 Z
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.2.2
48
+ rubygems_version: 2.5.1
49
49
  signing_key:
50
50
  specification_version: 4
51
51
  summary: Business logic