ellington 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: e98a3e401eca1277eaa5248eeb90ffc10249ab04
4
- data.tar.gz: 613d2ecbe5ec22d9f1352cfb406824ee39b0e870
3
+ metadata.gz: 0344a5af66ee51ee3c8882f88c386dedb341af3f
4
+ data.tar.gz: 0c64f876cd88662cb4ed88b259d273de39531b20
5
5
  SHA512:
6
- metadata.gz: ba0584803ce5aeb7aef48ec18082b1fc20512031b0714bba4c566348c5edec48ed16dddf257574f7db867313a2b8717ac0b518a1f3fc0248d094425d642867fa
7
- data.tar.gz: b3526b5577c320bc7d166a0f54ba4224d08023e40dd0240652d7cca60c953efb6965ea83bf1d17aea3315b68dfa7d2d95d4a3aa641ae49d41f345e6aef319078
6
+ metadata.gz: 24d6b1be361064d855ad38cc86bdd4eaf2bdf37eac484c7ed545b874675efab065f0abb0e804e43af5b1215856e037c5fc2ce9e62dd790b33e8c0ce2af1989f9
7
+ data.tar.gz: f0081020ed0c41b0d5688d7adafc398f5f891e84db510c1017d616478c282c8d4f6a65bc0f8ba2ea6e5e9905086e1acc03118fa772266f4463c8d409e1b29d8d
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ellington (0.2.4)
4
+ ellington (0.3.0)
5
5
  hero (~> 0.2.0)
6
6
  ruby-graphviz (~> 1.2.1)
7
7
  state_jacket (~> 0.1.1)
@@ -12,7 +12,12 @@ GEM
12
12
  awesome_print (1.2.0)
13
13
  binding_of_caller (0.7.2)
14
14
  debug_inspector (>= 0.0.1)
15
+ byebug (3.5.1)
16
+ columnize (~> 0.8)
17
+ debugger-linecache (~> 1.2)
18
+ slop (~> 3.6)
15
19
  coderay (1.1.0)
20
+ columnize (0.9.0)
16
21
  coveralls (0.7.2)
17
22
  multi_json (~> 1.3)
18
23
  rest-client (= 1.6.7)
@@ -20,6 +25,7 @@ GEM
20
25
  term-ansicolor (= 1.2.2)
21
26
  thor (= 0.18.1)
22
27
  debug_inspector (0.0.2)
28
+ debugger-linecache (1.2.0)
23
29
  docile (1.1.5)
24
30
  hero (0.2.0)
25
31
  interception (0.5)
@@ -31,6 +37,9 @@ GEM
31
37
  coderay (~> 1.1.0)
32
38
  method_source (~> 0.8.1)
33
39
  slop (~> 3.4)
40
+ pry-byebug (2.0.0)
41
+ byebug (~> 3.4)
42
+ pry (~> 0.10)
34
43
  pry-rescue (1.4.1)
35
44
  interception (>= 0.5)
36
45
  pry
@@ -64,6 +73,7 @@ DEPENDENCIES
64
73
  coveralls
65
74
  ellington!
66
75
  pry
76
+ pry-byebug
67
77
  pry-rescue
68
78
  pry-stack_explorer
69
79
  pry-test
@@ -0,0 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.join(File.dirname(__FILE__), "lib", "ellington", "version")
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = "ellington"
6
+ gem.license = "MIT"
7
+ gem.version = Ellington::VERSION
8
+ gem.authors = ["Nathan Hopkins"]
9
+ gem.email = ["natehop@gmail.com"]
10
+ gem.homepage = "https://github.com/hopsoft/ellington"
11
+ gem.summary = "An opinionated framework for modeling complex business processes."
12
+ gem.description = "An opinionated framework for modeling complex business processes."
13
+
14
+ gem.files = Dir["lib/**/*.rb", "[A-Z]*"]
15
+ gem.test_files = Dir["test/**/*.rb"]
16
+ gem.require_paths = ["lib"]
17
+
18
+ gem.add_dependency "hero", "~> 0.2.0"
19
+ gem.add_dependency "state_jacket", "~> 0.1.1"
20
+ gem.add_dependency "ruby-graphviz", "~> 1.2.1"
21
+
22
+ gem.add_development_dependency "rake"
23
+ gem.add_development_dependency "awesome_print"
24
+ gem.add_development_dependency "pry"
25
+ gem.add_development_dependency "pry-test"
26
+ gem.add_development_dependency "pry-stack_explorer"
27
+ gem.add_development_dependency "pry-rescue"
28
+ gem.add_development_dependency "pry-byebug"
29
+ gem.add_development_dependency "spoof"
30
+ gem.add_development_dependency "simplecov"
31
+ gem.add_development_dependency "coveralls"
32
+ end
@@ -16,7 +16,11 @@ module Ellington
16
16
  end
17
17
 
18
18
  def conduct(passenger)
19
- passenger = route.create_passenger(passenger) unless passenger.is_a?(Passenger)
19
+ if !passenger.is_a?(Ellington::Passenger)
20
+ ticket = Ellington::Ticket.new
21
+ passenger = Ellington::Passenger.new(passenger, ticket: ticket, state_history: [])
22
+ end
23
+ passenger.current_state = route.initial_state
20
24
  return unless verify(passenger)
21
25
  route.lines.first.board passenger
22
26
  end
@@ -4,11 +4,10 @@ module Ellington
4
4
  class Passenger < SimpleDelegator
5
5
  include Observable
6
6
  attr_accessor :context, :ticket
7
- attr_reader :route, :state_history
7
+ attr_reader :state_history
8
8
 
9
- def initialize(context, route: route, ticket: Ellington::Ticket.new, state_history: [])
9
+ def initialize(context, ticket: Ellington::Ticket.new, state_history: [])
10
10
  @context = context
11
- @route = route
12
11
  @ticket = ticket
13
12
  @state_history = state_history
14
13
  super context
@@ -28,8 +27,8 @@ module Ellington
28
27
  (state_history & states).length == states.length
29
28
  end
30
29
 
31
- def transition_to(new_state)
32
- if !route.states.can_transition?(current_state => new_state)
30
+ def transition_to(new_state, state_jacket: nil)
31
+ if !state_jacket.can_transition?(current_state => new_state)
33
32
  message = "Cannot transition #{self.class.name} from:#{current_state} to:#{new_state}"
34
33
  raise Ellington::InvalidStateTransition.new(message)
35
34
  end
@@ -37,7 +36,7 @@ module Ellington
37
36
  old_state = current_state
38
37
 
39
38
  if context.respond_to?(:transition_to)
40
- return_value = context.transition_to(new_state)
39
+ return_value = context.transition_to(new_state, state_jacket: state_jacket)
41
40
  else
42
41
  self.current_state = new_state
43
42
  end
@@ -35,12 +35,6 @@ module Ellington
35
35
  end
36
36
  end
37
37
 
38
- def create_passenger(context, ticket: Ellington::Ticket.new, state_history: [])
39
- passenger = Passenger.new(context, route: self, ticket: ticket, state_history: state_history)
40
- passenger.current_state = initial_state
41
- passenger
42
- end
43
-
44
38
  class << self
45
39
  include Observable
46
40
  include HasTargets
@@ -84,15 +84,15 @@ module Ellington
84
84
  end
85
85
 
86
86
  def pass_passenger(passenger)
87
- passenger.transition_to passed
87
+ passenger.transition_to passed, state_jacket: route.states
88
88
  end
89
89
 
90
90
  def fail_passenger(passenger)
91
- passenger.transition_to failed
91
+ passenger.transition_to failed, state_jacket: route.states
92
92
  end
93
93
 
94
94
  def error_passenger(passenger)
95
- passenger.transition_to errored
95
+ passenger.transition_to errored, state_jacket: route.states
96
96
  end
97
97
 
98
98
  def state(passenger)
@@ -1,3 +1,3 @@
1
1
  module Ellington
2
- VERSION = "0.2.4"
2
+ VERSION = "0.3.0"
3
3
  end
data/pry ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby --
2
+
3
+ require_relative "lib/ellington"
4
+ require_relative "examples/math_trick/loader"
5
+ require_relative "examples/social_media/loader"
6
+ require "pry"
7
+ Pry.start
data/tags ADDED
@@ -0,0 +1,248 @@
1
+ !_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
2
+ !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3
+ !_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
4
+ !_TAG_PROGRAM_NAME Exuberant Ctags //
5
+ !_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
6
+ !_TAG_PROGRAM_VERSION 5.8 //
7
+ Add10 test/example.rb /^class Add10 < Ellington::Station$/;" c
8
+ Add100 test/example.rb /^class Add100 < Ellington::Station$/;" c
9
+ Add1000 test/example.rb /^class Add1000 < Ellington::Station$/;" c
10
+ AddStation examples/math_trick/stations/add_station.rb /^class AddStation < Ellington::Station$/;" c
11
+ Addition test/example.rb /^class Addition < Ellington::Line$/;" c
12
+ Attendant lib/ellington/attendant.rb /^ class Attendant$/;" c class:Ellington
13
+ AttendantDisapproves lib/ellington/errros.rb /^ class AttendantDisapproves < StandardError$/;" c class:Ellington
14
+ AttendantTest test/attendant_test.rb /^class AttendantTest < PryTest::Test$/;" c
15
+ BasicMath test/example.rb /^class BasicMath < Ellington::Route$/;" c
16
+ BillCreditCard examples/social_media/stations/bill_credit_card.rb /^class BillCreditCard < Ellington::Station$/;" c
17
+ Billing examples/social_media/lines/billing.rb /^class Billing < Ellington::Line$/;" c
18
+ Blast examples/social_media/routes/blast.rb /^class Blast < Ellington::Route$/;" c
19
+ BlastObserver examples/social_media/blast_observer.rb /^class BlastObserver$/;" c
20
+ CanPost examples/social_media/stations/can_post.rb /^class CanPost < Ellington::Station$/;" c
21
+ CanTweet examples/social_media/stations/can_tweet.rb /^class CanTweet < Ellington::Station$/;" c
22
+ Conductor lib/ellington/conductor.rb /^ class Conductor$/;" c class:Ellington
23
+ ConductorTest test/conductor_test.rb /^class ConductorTest < PryTest::Test$/;" c
24
+ Connection lib/ellington/connection.rb /^ class Connection$/;" c class:Ellington
25
+ ConnectionList lib/ellington/connection_list.rb /^ class ConnectionList < SimpleDelegator$/;" c class:Ellington
26
+ ConnectionTest test/connection_test.rb /^class ConnectionTest < PryTest::Test$/;" c
27
+ DivideBy10 test/example.rb /^class DivideBy10 < Ellington::Station$/;" c
28
+ DivideBy100 test/example.rb /^class DivideBy100 < Ellington::Station$/;" c
29
+ DivideBy1000 test/example.rb /^class DivideBy1000 < Ellington::Station$/;" c
30
+ Division test/example.rb /^class Division < Ellington::Line$/;" c
31
+ Ellington lib/ellington/attendant.rb /^module Ellington$/;" m
32
+ Ellington lib/ellington/conductor.rb /^module Ellington$/;" m
33
+ Ellington lib/ellington/connection.rb /^module Ellington$/;" m
34
+ Ellington lib/ellington/connection_list.rb /^module Ellington$/;" m
35
+ Ellington lib/ellington/errros.rb /^module Ellington$/;" m
36
+ Ellington lib/ellington/has_targets.rb /^module Ellington$/;" m
37
+ Ellington lib/ellington/line.rb /^module Ellington$/;" m
38
+ Ellington lib/ellington/line_info.rb /^module Ellington$/;" m
39
+ Ellington lib/ellington/line_list.rb /^module Ellington$/;" m
40
+ Ellington lib/ellington/logger.rb /^module Ellington$/;" m
41
+ Ellington lib/ellington/passenger.rb /^module Ellington$/;" m
42
+ Ellington lib/ellington/route.rb /^module Ellington$/;" m
43
+ Ellington lib/ellington/route_info.rb /^module Ellington$/;" m
44
+ Ellington lib/ellington/station.rb /^module Ellington$/;" m
45
+ Ellington lib/ellington/station_info.rb /^module Ellington$/;" m
46
+ Ellington lib/ellington/station_list.rb /^module Ellington$/;" m
47
+ Ellington lib/ellington/target.rb /^module Ellington$/;" m
48
+ Ellington lib/ellington/ticket.rb /^module Ellington$/;" m
49
+ Ellington lib/ellington/transition_info.rb /^module Ellington$/;" m
50
+ Ellington lib/ellington/unique_type_array.rb /^module Ellington$/;" m
51
+ Ellington lib/ellington/version.rb /^module Ellington$/;" m
52
+ Ellington lib/ellington/visualizer.rb /^module Ellington$/;" m
53
+ Facebook examples/social_media/lines/facebook.rb /^class Facebook < Ellington::Line$/;" c
54
+ FirstReverseStation examples/math_trick/stations/first_reverse_station.rb /^class FirstReverseStation < Ellington::Station$/;" c
55
+ HasTargets lib/ellington/has_targets.rb /^ module HasTargets$/;" m class:Ellington
56
+ InvalidStateTransition lib/ellington/errros.rb /^ class InvalidStateTransition < StandardError$/;" c class:Ellington
57
+ Line lib/ellington/line.rb /^ class Line$/;" c class:Ellington
58
+ LineInfo lib/ellington/line_info.rb /^ class LineInfo < SimpleDelegator$/;" c class:Ellington
59
+ LineInfoTest test/line_info_test.rb /^class LineInfoTest < PryTest::Test$/;" c
60
+ LineList lib/ellington/line_list.rb /^ class LineList < SimpleDelegator$/;" c class:Ellington
61
+ LineTest test/line_test.rb /^class LineTest < PryTest::Test$/;" c
62
+ ListAlreadyContainsType lib/ellington/errros.rb /^ class ListAlreadyContainsType < StandardError$/;" c class:Ellington
63
+ LoggerTest test/logger_test.rb /^class LoggerTest < PryTest::Test$/;" c
64
+ MathTrick examples/math_trick/routes/math_trick.rb /^class MathTrick < Ellington::Route$/;" c
65
+ MockStationHelper examples/social_media/stations/mock_station_helper.rb /^class MockStationHelper$/;" c
66
+ Multiplication test/example.rb /^class Multiplication < Ellington::Line$/;" c
67
+ MultiplyBy10 test/example.rb /^class MultiplyBy10 < Ellington::Station$/;" c
68
+ MultiplyBy100 test/example.rb /^class MultiplyBy100 < Ellington::Station$/;" c
69
+ MultiplyBy1000 test/example.rb /^class MultiplyBy1000 < Ellington::Station$/;" c
70
+ NoGoalDeclared lib/ellington/errros.rb /^ class NoGoalDeclared < StandardError$/;" c class:Ellington
71
+ NoGoalLine test/line_test.rb /^ class NoGoalLine < Ellington::Line$/;" c
72
+ NoGoalRoute test/route_test.rb /^ class NoGoalRoute < Ellington::Route$/;" c
73
+ NoLinesDeclared lib/ellington/errros.rb /^ class NoLinesDeclared < StandardError$/;" c class:Ellington
74
+ NoLinesRoute test/route_test.rb /^ class NoLinesRoute < Ellington::Route$/;" c class:RouteTest
75
+ NoStationsDeclared lib/ellington/errros.rb /^ class NoStationsDeclared < StandardError$/;" c class:Ellington
76
+ NoStationsLine test/line_test.rb /^ class NoStationsLine < Ellington::Line$/;" c class:LineTest
77
+ Node lib/ellington/visualizer.rb /^ class Node < SimpleDelegator$/;" c class:Ellington.Visualizer
78
+ NotImplementedError lib/ellington/errros.rb /^ class NotImplementedError < StandardError$/;" c class:Ellington
79
+ NumberWithHistory test/example.rb /^class NumberWithHistory$/;" c
80
+ Passenger lib/ellington/passenger.rb /^ class Passenger < SimpleDelegator$/;" c class:Ellington
81
+ PassengerTest test/passenger_test.rb /^class PassengerTest < PryTest::Test$/;" c
82
+ Post examples/social_media/stations/post.rb /^class Post < Ellington::Station$/;" c
83
+ Route lib/ellington/route.rb /^ class Route < SimpleDelegator$/;" c class:Ellington
84
+ RouteInfo lib/ellington/route_info.rb /^ class RouteInfo < SimpleDelegator$/;" c class:Ellington
85
+ RouteInfoTest test/route_info_test.rb /^class RouteInfoTest < PryTest::Test$/;" c
86
+ RouteTest test/route_test.rb /^class RouteTest < PryTest::Test$/;" c
87
+ SecondReverseStation examples/math_trick/stations/second_reverse_station.rb /^class SecondReverseStation < Ellington::Station$/;" c
88
+ SendBillingNotification examples/social_media/stations/send_billing_notification.rb /^class SendBillingNotification < Ellington::Station$/;" c
89
+ ShouldPost examples/social_media/stations/should_post.rb /^class ShouldPost < Ellington::Station$/;" c
90
+ ShouldTweet examples/social_media/stations/should_tweet.rb /^class ShouldTweet < Ellington::Station$/;" c
91
+ Station lib/ellington/station.rb /^ class Station$/;" c class:Ellington
92
+ StationInfo lib/ellington/station_info.rb /^ class StationInfo$/;" c class:Ellington
93
+ StationInfoTest test/station_info_test.rb /^class StationInfoTest < PryTest::Test$/;" c
94
+ StationList lib/ellington/station_list.rb /^ class StationList < SimpleDelegator$/;" c class:Ellington
95
+ StationTest test/station_test.rb /^class StationTest < PryTest::Test$/;" c
96
+ SubtractStation examples/math_trick/stations/subtract_station.rb /^class SubtractStation < Ellington::Station$/;" c
97
+ Target lib/ellington/target.rb /^ class Target < SimpleDelegator$/;" c class:Ellington
98
+ TargetTest test/target_test.rb /^class TargetTest < PryTest::Test$/;" c
99
+ Ticket lib/ellington/ticket.rb /^ class Ticket < SimpleDelegator$/;" c class:Ellington
100
+ TicketTest test/ticket_test.rb /^class TicketTest < PryTest::Test$/;" c
101
+ TransitionInfo lib/ellington/transition_info.rb /^ class TransitionInfo < Struct.new(:passenger, :old_state, :new_state)$/;" c class:Ellington
102
+ TransitionInfoTest test/transition_info_test.rb /^class TransitionInfoTest < PryTest::Test$/;" c
103
+ TrickWith1089 examples/math_trick/lines/trick_with_1089.rb /^class TrickWith1089 < Ellington::Line$/;" c
104
+ Tweet examples/social_media/stations/tweet.rb /^class Tweet < Ellington::Station$/;" c
105
+ Twitter examples/social_media/lines/twitter.rb /^class Twitter < Ellington::Line$/;" c
106
+ UniqueTypeArray lib/ellington/unique_type_array.rb /^ class UniqueTypeArray < SimpleDelegator$/;" c class:Ellington
107
+ UniqueTypeArrayTest test/unique_type_array_test.rb /^class UniqueTypeArrayTest < PryTest::Test$/;" c
108
+ User examples/social_media/user.rb /^class User$/;" c
109
+ VerifyCreditCard examples/social_media/stations/verify_credit_card.rb /^class VerifyCreditCard < Ellington::Station$/;" c
110
+ VerifyFacebookToken examples/social_media/stations/verify_facebook_token.rb /^class VerifyFacebookToken < Ellington::Station$/;" c
111
+ VerifyTwitterToken examples/social_media/stations/verify_twitter_token.rb /^class VerifyTwitterToken < Ellington::Station$/;" c
112
+ Visualizer lib/ellington/visualizer.rb /^ class Visualizer$/;" c class:Ellington
113
+ add lib/ellington/line_list.rb /^ def add(line)$/;" f class:Ellington.LineList
114
+ add lib/ellington/station_list.rb /^ def add(station)$/;" f class:Ellington.StationList
115
+ add lib/ellington/visualizer.rb /^ def add(node)$/;" f class:Ellington.Visualizer.Node
116
+ add_state_nodes_for_line lib/ellington/visualizer.rb /^ def add_state_nodes_for_line(cluster, line, passenger)$/;" f class:Ellington.Visualizer
117
+ approve? lib/ellington/attendant.rb /^ def approve?$/;" f class:Ellington.Attendant
118
+ board lib/ellington/line.rb /^ def board(passenger, options={})$/;" f class:Ellington
119
+ board lib/ellington/route.rb /^ def board(passenger, options={})$/;" f class:Ellington.Route
120
+ boarded? lib/ellington/line.rb /^ def boarded?(passenger)$/;" f class:Ellington
121
+ calc test/example.rb /^ def calc(operand, other)$/;" f class:NumberWithHistory
122
+ call lib/ellington/station.rb /^ def call(passenger, options={})$/;" f class:Ellington.Station
123
+ can_engage? lib/ellington/station.rb /^ def can_engage?(passenger, options={})$/;" f class:Ellington.Station
124
+ check lib/ellington/connection_list.rb /^ def check(connection)$/;" f class:Ellington.ConnectionList
125
+ check lib/ellington/unique_type_array.rb /^ def check(value)$/;" f class:Ellington.UniqueTypeArray
126
+ color_name lib/ellington/visualizer.rb /^ def color_name(graphviz_color)$/;" f class:Ellington.Visualizer
127
+ complete_line lib/ellington/line.rb /^ def complete_line(line_info)$/;" f class:Ellington
128
+ complete_route lib/ellington/route.rb /^ def complete_route(route_info)$/;" f class:Ellington.Route
129
+ conduct lib/ellington/conductor.rb /^ def conduct(passenger)$/;" f class:Ellington.Conductor
130
+ connect_to lib/ellington/route.rb /^ def connect_to(line, options)$/;" f class:Ellington.Route
131
+ connections lib/ellington/route.rb /^ def connections$/;" f class:Ellington.Route
132
+ contains_a? lib/ellington/unique_type_array.rb /^ def contains_a?(klass)$/;" f class:Ellington.UniqueTypeArray
133
+ current_message examples/social_media/user.rb /^ def current_message$/;" f class:User
134
+ current_state lib/ellington/passenger.rb /^ def current_state$/;" f class:Ellington.Passenger
135
+ current_state= lib/ellington/passenger.rb /^ def current_state=(value)$/;" f class:Ellington.Passenger
136
+ engage examples/math_trick/stations/add_station.rb /^ def engage(number, options={})$/;" f class:AddStation
137
+ engage examples/math_trick/stations/first_reverse_station.rb /^ def engage(number, options={})$/;" f class:FirstReverseStation
138
+ engage examples/math_trick/stations/second_reverse_station.rb /^ def engage(number, options={})$/;" f class:SecondReverseStation
139
+ engage examples/math_trick/stations/subtract_station.rb /^ def engage(number, options={})$/;" f class:SubtractStation
140
+ engage examples/social_media/stations/bill_credit_card.rb /^ def engage(user, options)$/;" f class:BillCreditCard
141
+ engage examples/social_media/stations/can_post.rb /^ def engage(user, options)$/;" f class:CanPost
142
+ engage examples/social_media/stations/can_tweet.rb /^ def engage(user, options)$/;" f class:CanTweet
143
+ engage examples/social_media/stations/post.rb /^ def engage(user, options)$/;" f class:Post
144
+ engage examples/social_media/stations/send_billing_notification.rb /^ def engage(user, options)$/;" f class:SendBillingNotification
145
+ engage examples/social_media/stations/should_post.rb /^ def engage(user, options)$/;" f class:ShouldPost
146
+ engage examples/social_media/stations/should_tweet.rb /^ def engage(user, options)$/;" f class:ShouldTweet
147
+ engage examples/social_media/stations/tweet.rb /^ def engage(user, options)$/;" f class:Tweet
148
+ engage examples/social_media/stations/verify_credit_card.rb /^ def engage(user, options)$/;" f class:VerifyCreditCard
149
+ engage examples/social_media/stations/verify_facebook_token.rb /^ def engage(user, options)$/;" f class:VerifyFacebookToken
150
+ engage examples/social_media/stations/verify_twitter_token.rb /^ def engage(user, options)$/;" f class:VerifyTwitterToken
151
+ engage lib/ellington/station.rb /^ def engage(passenger, options={})$/;" f class:Ellington.Station
152
+ engage test/example.rb /^ def engage(number, options)$/;" f class:Add10
153
+ engage test/example.rb /^ def engage(number, options)$/;" f class:Add100
154
+ engage test/example.rb /^ def engage(number, options)$/;" f class:Add1000
155
+ engage test/example.rb /^ def engage(number, options)$/;" f class:DivideBy10
156
+ engage test/example.rb /^ def engage(number, options)$/;" f class:DivideBy100
157
+ engage test/example.rb /^ def engage(number, options)$/;" f class:DivideBy1000
158
+ engage test/example.rb /^ def engage(number, options)$/;" f class:MultiplyBy10
159
+ engage test/example.rb /^ def engage(number, options)$/;" f class:MultiplyBy100
160
+ engage test/example.rb /^ def engage(number, options)$/;" f class:MultiplyBy1000
161
+ error_passenger lib/ellington/station.rb /^ def error_passenger(passenger)$/;" f class:Ellington.Station
162
+ error_target lib/ellington/has_targets.rb /^ def error_target$/;" f class:Ellington.HasTargets
163
+ errored lib/ellington/station.rb /^ def errored$/;" f class:Ellington.Station
164
+ fail_passenger lib/ellington/station.rb /^ def fail_passenger(passenger)$/;" f class:Ellington.Station
165
+ fail_target lib/ellington/has_targets.rb /^ def fail_target$/;" f class:Ellington.HasTargets
166
+ failed lib/ellington/station.rb /^ def failed$/;" f class:Ellington.Station
167
+ find lib/ellington/visualizer.rb /^ def find(context)$/;" f class:Ellington.Visualizer.Node
168
+ find_by_type lib/ellington/line_list.rb /^ def find_by_type(type)$/;" f class:Ellington.LineList
169
+ find_by_type lib/ellington/station_list.rb /^ def find_by_type(type)$/;" f class:Ellington.StationList
170
+ formula lib/ellington/line.rb /^ def formula$/;" f class:Ellington
171
+ graph_lines lib/ellington/visualizer.rb /^ def graph_lines(passenger=nil)$/;" f class:Ellington.Visualizer
172
+ graph_lines_basic lib/ellington/visualizer.rb /^ def graph_lines_basic(passenger=nil)$/;" f class:Ellington.Visualizer
173
+ graph_route lib/ellington/visualizer.rb /^ def graph_route(passenger=nil)$/;" f class:Ellington.Visualizer
174
+ graph_route_basic lib/ellington/visualizer.rb /^ def graph_route_basic(passenger=nil)$/;" f class:Ellington.Visualizer
175
+ id examples/social_media/user.rb /^ def id$/;" f class:User
176
+ id lib/ellington/ticket.rb /^ def id$/;" f class:Ellington.Ticket
177
+ include? lib/ellington/target.rb /^ def include?(state)$/;" f class:Ellington.Target
178
+ inherited lib/ellington/route.rb /^ def inherited(subclass)$/;" f class:Ellington.Route
179
+ initial_state lib/ellington/route.rb /^ def initial_state$/;" f class:Ellington.Route
180
+ initial_states lib/ellington/line.rb /^ def initial_states$/;" f class:Ellington
181
+ initial_states lib/ellington/station.rb /^ def initial_states$/;" f class:Ellington.Station
182
+ initialize examples/social_media/blast_observer.rb /^ def initialize$/;" f class:BlastObserver
183
+ initialize examples/social_media/stations/mock_station_helper.rb /^ def initialize(station)$/;" f class:MockStationHelper
184
+ initialize lib/ellington/attendant.rb /^ def initialize(station)$/;" f class:Ellington.Attendant
185
+ initialize lib/ellington/conductor.rb /^ def initialize(route)$/;" f class:Ellington.Conductor
186
+ initialize lib/ellington/connection.rb /^ def initialize(line, type, *states)$/;" f class:Ellington.Connection
187
+ initialize lib/ellington/connection_list.rb /^ def initialize$/;" f class:Ellington.ConnectionList
188
+ initialize lib/ellington/line.rb /^ def initialize$/;" f class:Ellington
189
+ initialize lib/ellington/line_info.rb /^ def initialize(line, station_info)$/;" f class:Ellington.LineInfo
190
+ initialize lib/ellington/line_list.rb /^ def initialize(route_class)$/;" f class:Ellington.LineList
191
+ initialize lib/ellington/passenger.rb /^ def initialize(context, route, options={})$/;" f class:Ellington.Passenger
192
+ initialize lib/ellington/route.rb /^ def initialize$/;" f class:Ellington.Route
193
+ initialize lib/ellington/route_info.rb /^ def initialize(route, line_info)$/;" f class:Ellington.RouteInfo
194
+ initialize lib/ellington/station_info.rb /^ def initialize(station, passenger, transition, options)$/;" f class:Ellington.StationInfo
195
+ initialize lib/ellington/station_list.rb /^ def initialize(line_class)$/;" f class:Ellington.StationList
196
+ initialize lib/ellington/target.rb /^ def initialize(*states)$/;" f class:Ellington.Target
197
+ initialize lib/ellington/ticket.rb /^ def initialize(goal=nil, hash={})$/;" f class:Ellington.Ticket
198
+ initialize lib/ellington/unique_type_array.rb /^ def initialize$/;" f class:Ellington.UniqueTypeArray
199
+ initialize lib/ellington/visualizer.rb /^ def initialize(base, viz)$/;" f class:Ellington.Visualizer.Node
200
+ initialize lib/ellington/visualizer.rb /^ def initialize(route, format=:svg)$/;" f class:Ellington.Visualizer
201
+ initialize test/example.rb /^ def initialize(value)$/;" f class:NumberWithHistory
202
+ initialize_lines lib/ellington/route.rb /^ def initialize_lines$/;" f class:Ellington.Route
203
+ initialized? lib/ellington/route.rb /^ def initialized?$/;" f class:Ellington.Route
204
+ line_completed lib/ellington/route.rb /^ def line_completed(line_info)$/;" f class:Ellington.Route
205
+ lines lib/ellington/route.rb /^ def lines$/;" f class:Ellington.Route
206
+ log lib/ellington/line.rb /^ def log(line_info, options={})$/;" f class:Ellington
207
+ log lib/ellington/route.rb /^ def log(route_info)$/;" f class:Ellington.Route
208
+ log_message lib/ellington/line_info.rb /^ def log_message(options={})$/;" f class:Ellington.LineInfo
209
+ log_message lib/ellington/route_info.rb /^ def log_message(options={})$/;" f class:Ellington.RouteInfo
210
+ log_options lib/ellington/route.rb /^ def log_options(options={})$/;" f class:Ellington.Route
211
+ logger lib/ellington/logger.rb /^ def self.logger$/;" F class:Ellington
212
+ logger lib/ellington/logger.rb /^ def self.logger=(value)$/;" F class:Ellington
213
+ mock_engage examples/social_media/stations/mock_station_helper.rb /^ def mock_engage(user, options)$/;" f class:MockStationHelper
214
+ name lib/ellington/line.rb /^ def name$/;" f class:Ellington
215
+ name lib/ellington/station.rb /^ def name$/;" f class:Ellington.Station
216
+ name lib/ellington/visualizer.rb /^ def name$/;" f class:Ellington.Visualizer.Node
217
+ pass_passenger lib/ellington/station.rb /^ def pass_passenger(passenger)$/;" f class:Ellington.Station
218
+ pass_target lib/ellington/line.rb /^ def pass_target(*states)$/;" f class:Ellington.Line
219
+ pass_target lib/ellington/route.rb /^ def pass_target(*line_goals)$/;" f class:Ellington.Route
220
+ passed lib/ellington/station.rb /^ def passed$/;" f class:Ellington.Station
221
+ push lib/ellington/connection_list.rb /^ def push(connection)$/;" f class:Ellington.ConnectionList
222
+ push lib/ellington/line_list.rb /^ def push(line)$/;" f class:Ellington.LineList
223
+ push lib/ellington/station_list.rb /^ def push(station)$/;" f class:Ellington.StationList
224
+ push lib/ellington/unique_type_array.rb /^ def push(value)$/;" f class:Ellington.UniqueTypeArray
225
+ required? lib/ellington/connection.rb /^ def required?(passenger)$/;" f class:Ellington.Connection
226
+ required_connections lib/ellington/route.rb /^ def required_connections(passenger)$/;" f class:Ellington.Route
227
+ route_completed examples/social_media/blast_observer.rb /^ def route_completed(route_info)$/;" f class:BlastObserver
228
+ satisfied? lib/ellington/target.rb /^ def satisfied?(passenger)$/;" f class:Ellington.Target
229
+ set_cluster_defaults lib/ellington/visualizer.rb /^ def set_cluster_defaults(cluster)$/;" f class:Ellington.Visualizer
230
+ set_graph_defaults lib/ellington/visualizer.rb /^ def set_graph_defaults(graph)$/;" f class:Ellington.Visualizer
231
+ state lib/ellington/has_targets.rb /^ def state(passenger)$/;" f class:Ellington.HasTargets
232
+ state lib/ellington/station.rb /^ def state(passenger)$/;" f class:Ellington.Station
233
+ state_history_includes? lib/ellington/passenger.rb /^ def state_history_includes?(*states)$/;" f class:Ellington.Passenger
234
+ state_name lib/ellington/station.rb /^ def state_name(state)$/;" f class:Ellington.Station
235
+ state_names lib/ellington/has_targets.rb /^ def state_names(states)$/;" f class:Ellington.HasTargets
236
+ states lib/ellington/line.rb /^ def states$/;" f class:Ellington
237
+ states lib/ellington/route.rb /^ def states$/;" f class:Ellington.Route
238
+ states lib/ellington/station.rb /^ def states$/;" f class:Ellington.Station
239
+ station_completed lib/ellington/line.rb /^ def station_completed(station_info)$/;" f class:Ellington
240
+ station_full_name lib/ellington/line_info.rb /^ def station_full_name$/;" f class:Ellington.LineInfo
241
+ stations lib/ellington/line.rb /^ def stations$/;" f class:Ellington.Line
242
+ style_node lib/ellington/visualizer.rb /^ def style_node(node, color)$/;" f class:Ellington.Visualizer
243
+ style_node_for_line lib/ellington/visualizer.rb /^ def style_node_for_line(node, line, *states)$/;" f class:Ellington.Visualizer
244
+ style_node_for_passenger lib/ellington/visualizer.rb /^ def style_node_for_passenger(node, passenger, *states)$/;" f class:Ellington.Visualizer
245
+ style_node_for_route lib/ellington/visualizer.rb /^ def style_node_for_route(node, route, *states)$/;" f class:Ellington.Visualizer
246
+ transition_to lib/ellington/passenger.rb /^ def transition_to(new_state)$/;" f class:Ellington.Passenger
247
+ update lib/ellington/attendant.rb /^ def update(transition_info)$/;" f class:Ellington.Attendant
248
+ verify lib/ellington/conductor.rb /^ def verify(passenger)$/;" f class:Ellington.Conductor
@@ -3,34 +3,34 @@ require_relative "test_helper"
3
3
  class AttendantTest < PryTest::Test
4
4
 
5
5
  before do
6
- route = BasicMath.new
7
- line = route.lines.first
6
+ @route = BasicMath.new
7
+ line = @route.lines.first
8
8
  @station = line.stations.first
9
- @passenger = Ellington::Passenger.new(NumberWithHistory.new(0), route: route)
10
- @passenger.current_state = route.initial_state
9
+ @passenger = Ellington::Passenger.new(NumberWithHistory.new(0))
10
+ @passenger.current_state = @route.initial_state
11
11
  @attendant = Ellington::Attendant.new(@station)
12
12
  @passenger.add_observer @attendant
13
13
  end
14
14
 
15
15
  test "passenger transition is captured" do
16
- @passenger.transition_to @station.passed
16
+ @passenger.transition_to @station.passed, state_jacket: @route.states
17
17
  assert @attendant.passenger_transitions.length == 1
18
18
  end
19
19
 
20
20
  test "approves of single passenger transition" do
21
- @passenger.transition_to @station.passed
21
+ @passenger.transition_to @station.passed, state_jacket: @route.states
22
22
  assert @attendant.approve?
23
23
  end
24
24
 
25
25
  test "multiple passenger transitions are captured" do
26
- @passenger.transition_to @station.errored
27
- @passenger.transition_to @station.passed
26
+ @passenger.transition_to @station.errored, state_jacket: @route.states
27
+ @passenger.transition_to @station.passed, state_jacket: @route.states
28
28
  assert @attendant.passenger_transitions.length == 2
29
29
  end
30
30
 
31
31
  test "disapproves of multiple passenger transitions" do
32
- @passenger.transition_to @station.errored
33
- @passenger.transition_to @station.passed
32
+ @passenger.transition_to @station.errored, state_jacket: @route.states
33
+ @passenger.transition_to @station.passed, state_jacket: @route.states
34
34
  assert !@attendant.approve?
35
35
  end
36
36
 
@@ -5,7 +5,7 @@ class ConductorTest < PryTest::Test
5
5
  before do
6
6
  @route = BasicMath.new
7
7
  @conductor = Ellington::Conductor.new(@route)
8
- @passenger = Ellington::Passenger.new(NumberWithHistory.new(0), route: @route)
8
+ @passenger = Ellington::Passenger.new(NumberWithHistory.new(0))
9
9
  @passenger.current_state = @route.initial_state
10
10
  end
11
11
 
@@ -6,7 +6,7 @@ class LineInfoTest < PryTest::Test
6
6
  @route = BasicMath.new
7
7
  @line = @route.lines.first
8
8
  @station = @line.stations.first
9
- @passenger = Ellington::Passenger.new(NumberWithHistory.new(0), route: @route)
9
+ @passenger = Ellington::Passenger.new(NumberWithHistory.new(0))
10
10
  @transition_info = Ellington::TransitionInfo.new(@passenger, @route.initial_state, @station.passed)
11
11
  @station_info = Ellington::StationInfo.new(@station, @passenger, @transition_info)
12
12
  @line_info = Ellington::LineInfo.new(@line, @station_info)
@@ -5,7 +5,7 @@ class LineTest < PryTest::Test
5
5
  before do
6
6
  @route = BasicMath.new
7
7
  @line = @route.lines.first
8
- @passenger = Ellington::Passenger.new(NumberWithHistory.new(0), route: @route)
8
+ @passenger = Ellington::Passenger.new(NumberWithHistory.new(0))
9
9
  end
10
10
 
11
11
  test "must declare stations" do
@@ -5,23 +5,23 @@ class PassengerTest < PryTest::Test
5
5
  before do
6
6
  @route = BasicMath.new
7
7
  @number = NumberWithHistory.new(0)
8
- @passenger = Ellington::Passenger.new(@number, route: @route)
8
+ @passenger = Ellington::Passenger.new(@number)
9
9
  end
10
10
 
11
11
  test "construct with ticket option" do
12
12
  ticket = Ellington::Ticket.new
13
- passenger = Ellington::Passenger.new(@number, route: @route, :ticket => ticket)
13
+ passenger = Ellington::Passenger.new(@number, :ticket => ticket)
14
14
  assert passenger.ticket == ticket
15
15
  end
16
16
 
17
17
  test "construct with state_history option" do
18
- passenger = Ellington::Passenger.new(@number, route: @route, :state_history => [:foo, :bar])
18
+ passenger = Ellington::Passenger.new(@number, :state_history => [:foo, :bar])
19
19
  assert passenger.state_history == [:foo, :bar]
20
20
  end
21
21
 
22
22
  test "transition_to valid state" do
23
23
  @passenger.current_state = @route.initial_state
24
- @passenger.transition_to @route.lines.first.states.keys.first
24
+ @passenger.transition_to @route.lines.first.states.keys.first, state_jacket: @route.states
25
25
  assert @passenger.current_state == @route.lines.first.states.keys.first
26
26
  end
27
27
 
@@ -29,7 +29,7 @@ class PassengerTest < PryTest::Test
29
29
  error = nil
30
30
  begin
31
31
  @passenger.current_state = :error
32
- @passenger.transition_to :happy
32
+ @passenger.transition_to :happy, state_jacket: @route.states
33
33
  rescue Ellington::InvalidStateTransition => e
34
34
  error = e
35
35
  end
@@ -46,7 +46,7 @@ class PassengerTest < PryTest::Test
46
46
 
47
47
  @passenger.add_observer(watcher)
48
48
  @passenger.current_state = @route.initial_state
49
- @passenger.transition_to @route.lines.first.states.keys.first
49
+ @passenger.transition_to @route.lines.first.states.keys.first, state_jacket: @route.states
50
50
 
51
51
  assert watcher.info.passenger == @passenger
52
52
  assert watcher.info.old_state == "PRE BasicMath"
@@ -55,8 +55,8 @@ class PassengerTest < PryTest::Test
55
55
 
56
56
  test "state_history" do
57
57
  @passenger.current_state = @route.initial_state
58
- @passenger.transition_to @route.lines[0].states.keys.first
59
- @passenger.transition_to @route.lines[2].states.keys.first
58
+ @passenger.transition_to @route.lines[0].states.keys.first, state_jacket: @route.states
59
+ @passenger.transition_to @route.lines[2].states.keys.first, state_jacket: @route.states
60
60
  assert @passenger.state_history == ["PASS Addition Add10", "PASS Multiplication MultiplyBy10"]
61
61
  end
62
62
 
@@ -6,7 +6,7 @@ class RouteInfoTest < PryTest::Test
6
6
  @route = BasicMath.new
7
7
  @line = @route.lines.first
8
8
  @station = @line.stations.first
9
- @passenger = Ellington::Passenger.new(NumberWithHistory.new(0), route: @route)
9
+ @passenger = Ellington::Passenger.new(NumberWithHistory.new(0))
10
10
  @passenger.current_state = @route.lines.last.passed.first
11
11
  @transition_info = Ellington::TransitionInfo.new(@passenger, @route.initial_state, @station.passed)
12
12
  @station_info = Ellington::StationInfo.new(@station, @passenger, @transition_info)
@@ -4,7 +4,7 @@ class RouteTest < PryTest::Test
4
4
 
5
5
  before do
6
6
  @route = BasicMath.new
7
- @passenger = Ellington::Passenger.new(NumberWithHistory.new(0), route: @route)
7
+ @passenger = Ellington::Passenger.new(NumberWithHistory.new(0))
8
8
  end
9
9
 
10
10
  test "must declare lines" do
@@ -6,7 +6,7 @@ class StationInfoTest < PryTest::Test
6
6
  @route = BasicMath.new
7
7
  @line = @route.lines.first
8
8
  @station = @line.stations.first
9
- @passenger = Ellington::Passenger.new(NumberWithHistory.new(0), route: @route)
9
+ @passenger = Ellington::Passenger.new(NumberWithHistory.new(0))
10
10
  @transition_info = Ellington::TransitionInfo.new(@passenger, @route.initial_state, @station.passed)
11
11
  @station_info = Ellington::StationInfo.new(@station, @passenger, @transition_info)
12
12
  end
@@ -6,7 +6,7 @@ class StationTest < PryTest::Test
6
6
  @route = BasicMath.new
7
7
  @line = @route.lines.first
8
8
  @station = @line.stations.first
9
- @passenger = Ellington::Passenger.new(NumberWithHistory.new(0), route: @route)
9
+ @passenger = Ellington::Passenger.new(NumberWithHistory.new(0))
10
10
  @passenger.current_state = @route.initial_state
11
11
  end
12
12
 
@@ -10,7 +10,7 @@ class TicketTest < PryTest::Test
10
10
  :debit_id => "b834fb69-2eb3-4e57-b313-16b863e91f74",
11
11
  :credit_id => "9a670fce-4826-4a90-aaf7-a58738a4ce5b"
12
12
  )
13
- @passenger = Ellington::Passenger.new(0, route: @route, :ticket => @ticket)
13
+ @passenger = Ellington::Passenger.new(0, :ticket => @ticket)
14
14
  end
15
15
 
16
16
  test "basic ticket" do
@@ -6,7 +6,7 @@ class TransitionInfoTest < PryTest::Test
6
6
  @route = BasicMath.new
7
7
  @line = @route.lines.first
8
8
  @station = @line.stations.first
9
- @passenger = Ellington::Passenger.new(NumberWithHistory.new(0), route: @route)
9
+ @passenger = Ellington::Passenger.new(NumberWithHistory.new(0))
10
10
  @transition_info = Ellington::TransitionInfo.new(@passenger, @route.initial_state, @station.passed)
11
11
  end
12
12
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ellington
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
  - Nathan Hopkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-22 00:00:00.000000000 Z
11
+ date: 2015-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hero
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: pry-byebug
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
  - !ruby/object:Gem::Dependency
140
154
  name: spoof
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -190,6 +204,7 @@ files:
190
204
  - LICENSE.txt
191
205
  - README.md
192
206
  - Rakefile
207
+ - ellington.gemspec
193
208
  - lib/ellington.rb
194
209
  - lib/ellington/attendant.rb
195
210
  - lib/ellington/conductor.rb
@@ -213,6 +228,8 @@ files:
213
228
  - lib/ellington/unique_type_array.rb
214
229
  - lib/ellington/version.rb
215
230
  - lib/ellington/visualizer.rb
231
+ - pry
232
+ - tags
216
233
  - test/attendant_test.rb
217
234
  - test/conductor_test.rb
218
235
  - test/connection_test.rb
@@ -250,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
267
  version: '0'
251
268
  requirements: []
252
269
  rubyforge_project:
253
- rubygems_version: 2.2.2
270
+ rubygems_version: 2.4.5
254
271
  signing_key:
255
272
  specification_version: 4
256
273
  summary: An opinionated framework for modeling complex business processes.
@@ -272,4 +289,3 @@ test_files:
272
289
  - test/ticket_test.rb
273
290
  - test/transition_info_test.rb
274
291
  - test/unique_type_array_test.rb
275
- has_rdoc: