laminar 0.3.0 → 0.4.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
- SHA1:
3
- metadata.gz: 3fb0486b2d99158c6fa192d237100a61bc9ae40e
4
- data.tar.gz: 0755f031eee6dfaefbb64d9301c3e27327c6088f
2
+ SHA256:
3
+ metadata.gz: cfa336597901d8c1c25976ced526555e981b731613daa6f916394b2ac71cb7a9
4
+ data.tar.gz: 9f5db130a19de3dda3ef4579bff68e103bf667e79759f5be0726c413efbacff1
5
5
  SHA512:
6
- metadata.gz: 5d7f0f34420a061583f4744cf16bfa6a899c8ccf8bd2cb2b8aa24c269c487290632084fbce0dd74e6f2f6540b54f4e605e6731f37e89e6c6bee5a5176f0f55fc
7
- data.tar.gz: 2fbbbef809c51fff94be71195e63fab67c8c93f9cb1ed0b96228e7dcc84e21a34572d31f4a48e18e6e23514686115a690f6d125581333626c7c1c93e1f2eb38a
6
+ metadata.gz: 9d054d187381bc5c768b490df36c65a02466a0ea30f198db208006491610fa23f371e1235a0e9f37ae251ad0a3997ecfaad7490dacb909912532c5e406d5af35
7
+ data.tar.gz: 6cb99ce2b271f7f6f1782de44a3fc1b2585412441a375cd4be77ea31544fd9813f7ecfe02f3cfe8968e121762933853a7da5f533185202106e860dc42d203feb
data/.rspec CHANGED
@@ -1,3 +1,3 @@
1
- --format documentation
2
1
  --color
3
2
  --require spec_helper
3
+ --order random
@@ -9,5 +9,9 @@ rvm:
9
9
  before_install: gem install bundler -v 1.16.5
10
10
  script:
11
11
  - bundle exec rspec
12
+ before_script:
13
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
14
+ - chmod +x ./cc-test-reporter
15
+ - ./cc-test-reporter before-build
12
16
  after_script:
13
17
  - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
@@ -34,7 +34,7 @@ module Laminar
34
34
  def halt!(context = {})
35
35
  @halted = true
36
36
  merge!(context)
37
- raise ParticleStopped, self
37
+ raise ParticleStopped.new(self)
38
38
  end
39
39
 
40
40
  def fail!(context = {})
@@ -40,7 +40,11 @@ module Laminar
40
40
  private
41
41
 
42
42
  def run_condition(target)
43
- target.send(@condition)
43
+ if @condition.is_a?(Proc)
44
+ @condition.call()
45
+ else
46
+ target.send(@condition)
47
+ end
44
48
  end
45
49
 
46
50
  def define_condition(options)
@@ -48,9 +52,9 @@ module Laminar
48
52
  return if @condition_type.nil?
49
53
 
50
54
  @condition = options[@condition_type]
51
- return if @condition.nil? || @condition.is_a?(Symbol)
55
+ return if @condition.nil? || @condition.is_a?(Symbol) || @condition.is_a?(Proc)
52
56
 
53
- raise TypeError, 'condition must be a method (symbol).'
57
+ raise TypeError, 'condition must be a method symbol or Proc).'
54
58
  end
55
59
  end
56
60
  end
@@ -43,6 +43,10 @@ module Laminar
43
43
  end
44
44
  alias goto branch
45
45
 
46
+ def endflow(options = {})
47
+ branches << Branch.new(:endflow, options)
48
+ end
49
+
46
50
  # Find the next rule in the flow. Examines the branches associated
47
51
  # with the current rule and returns the name of the first branch
48
52
  # that satisfies its condition.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Laminar
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: laminar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Lockerd
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-01 00:00:00.000000000 Z
11
+ date: 2018-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  requirements: []
135
135
  rubyforge_project:
136
- rubygems_version: 2.6.11
136
+ rubygems_version: 2.7.3
137
137
  signing_key:
138
138
  specification_version: 4
139
139
  summary: Simple, composable business objects & workflow