cobracommander 0.0.5 → 0.0.6.pre.pre

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 029dd883290480903c9c96ccca3a3a2ce4540e94
4
- data.tar.gz: 63163705c69296ab9721b8575ff8d645a3b087d3
3
+ metadata.gz: 1c1998ed1111082c636147dd139e35bc950adb55
4
+ data.tar.gz: 99e413d66c93c083bd94b9f80c6a360f2d0cb77c
5
5
  SHA512:
6
- metadata.gz: 6c1607b1c2a83377517a769666356ad3e596ab1950d891e555f6e888a8fcfdfd0a8503c5777e9ed27fd37ea559c34ef41a4ec921e9ed7fee31d1c96b5efa124f
7
- data.tar.gz: 1f552cf32d068916481fb1ebef996b85cd750b4efffa7a1b00cbd7890cc17297de102f89bc20d4a816f729581ab668a82511166ac2f0127f1d8d17bbe8efd20b
6
+ metadata.gz: 9d0ca6f867ef35e90d8a756642279247ead8433f9cd2d55baf350c84f416605764a635dfed176c446013d2da2cb6f69e54ab102c79ccc49ee4d6fbf35a717f99
7
+ data.tar.gz: 247c646013ba4625d56b22a76773ffcfba8d6de9eed8bf22ce0248c2142836ab2dae584b65bc8191ef4736b67c5060351fbf85725f4d0a63fe47e159a50f09af
@@ -1,8 +1,6 @@
1
1
  module CobraCommander
2
2
  # Abstract
3
3
  class Command
4
- attr_reader :reversible
5
-
6
4
  # @param nil
7
5
  # @return Array
8
6
  def expose
@@ -10,22 +8,16 @@ module CobraCommander
10
8
  end
11
9
 
12
10
  # NOTE: Meat of action should go here; assume Handler manages validation and just execute
11
+ # @param nil
12
+ # @return Error
13
13
  def execute
14
14
  raise NotImplementedError
15
15
  end
16
16
 
17
- def unexecute
18
- raise NotImplementedError if reversible?
19
- end
20
-
21
- def toggle_reversible
22
- @reversible = !@reversible
23
- end
24
-
25
17
  # @param nil
26
- # @return Boolean
27
- def reversible?
28
- @reversible
29
- end # is_reversible?()
18
+ # @return Error
19
+ def unexecute
20
+ raise NotImplementedError
21
+ end # unexecute()
30
22
  end # ::Command
31
23
  end
@@ -7,8 +7,18 @@ module CobraCommander
7
7
  command.expose.each do |cmd|
8
8
  handler = CobraCommander::CommandTranslator.map_to_handler(cmd)
9
9
  @handler = handler.new
10
- @handler.handle(cmd)
10
+ return @handler.handle(cmd)
11
11
  end
12
12
  end # execute()
13
+
14
+ # @param Command
15
+ # @return mixed
16
+ def unexecute(command)
17
+ command.expose.each do |cmd|
18
+ handler = CobraCommander::CommandTranslator.map_to_handler(cmd)
19
+ @handler = handler.new
20
+ return @handler.unhandle(cmd)
21
+ end
22
+ end # unexecute()
13
23
  end # ::CommandBus
14
24
  end
@@ -7,6 +7,18 @@ module CobraCommander
7
7
  # @return mixed
8
8
  def handle(command)
9
9
  command.execute
10
- end # handle()
10
+ end
11
+
12
+ # @param Command
13
+ # @return mixed
14
+ def unhandle(command)
15
+ command.unexecute
16
+ end
17
+
18
+ # NOTE: Leaving this in until I can figure out a more sensible way to validate arguments
19
+ # If this stays, I plan to call validate(command).execute() within the handle() method in order to provide validation without having to overwrite handle()
20
+ def validate(*args)
21
+
22
+ end # validate()
11
23
  end # ::CommandHandler
12
24
  end
@@ -1,8 +1,10 @@
1
1
  module CobraCommander
2
2
  # Abstract
3
3
  class CompositeCommand
4
- attr_reader :reversible, :cmds
4
+ attr_reader :cmds
5
5
 
6
+ # @param Array
7
+ # @return void
6
8
  def initialize(*commands)
7
9
  @cmds = commands
8
10
  end
@@ -31,22 +33,16 @@ module CobraCommander
31
33
  end
32
34
  end
33
35
 
36
+ # @param nil
37
+ # @return Error
34
38
  def execute
35
39
  raise NotImplementedError
36
40
  end
37
41
 
38
- def unexecute
39
- raise NotImplementedError if reversible?
40
- end
41
-
42
- def toggle_reversible
43
- @reversible = !@reversible
44
- end
45
-
46
42
  # @param nil
47
- # @return Boolean
48
- def reversible?
49
- @reversible
50
- end
51
- end
43
+ # @return Error
44
+ def unexecute
45
+ raise NotImplementedError
46
+ end # unexecute()
47
+ end # ::CompositeCommand
52
48
  end
@@ -1,3 +1,3 @@
1
1
  module CobraCommander
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6-pre"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cobracommander
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6.pre.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - DouglasDDo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-26 00:00:00.000000000 Z
11
+ date: 2016-08-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Ruby gem for implementing the Command Pattern.
14
14
  email:
@@ -77,9 +77,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
77
  version: '0'
78
78
  required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - ">"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 1.3.1
83
83
  requirements: []
84
84
  rubyforge_project:
85
85
  rubygems_version: 2.2.2
@@ -87,39 +87,39 @@ signing_key:
87
87
  specification_version: 4
88
88
  summary: A Ruby gem for implementing the Command Pattern.
89
89
  test_files:
90
- - test/dummy/Rakefile
91
- - test/dummy/public/404.html
92
- - test/dummy/public/favicon.ico
93
- - test/dummy/public/422.html
94
- - test/dummy/public/500.html
95
- - test/dummy/config/environment.rb
96
- - test/dummy/config/application.rb
90
+ - test/test_helper.rb
91
+ - test/dummy/bin/setup
92
+ - test/dummy/bin/bundle
93
+ - test/dummy/bin/rails
94
+ - test/dummy/bin/rake
97
95
  - test/dummy/config/database.yml
98
- - test/dummy/config/initializers/mime_types.rb
99
96
  - test/dummy/config/initializers/backtrace_silencers.rb
100
- - test/dummy/config/initializers/wrap_parameters.rb
101
- - test/dummy/config/initializers/filter_parameter_logging.rb
102
- - test/dummy/config/initializers/cookies_serializer.rb
103
- - test/dummy/config/initializers/assets.rb
97
+ - test/dummy/config/initializers/mime_types.rb
104
98
  - test/dummy/config/initializers/inflections.rb
99
+ - test/dummy/config/initializers/wrap_parameters.rb
105
100
  - test/dummy/config/initializers/session_store.rb
106
- - test/dummy/config/boot.rb
107
- - test/dummy/config/environments/development.rb
101
+ - test/dummy/config/initializers/assets.rb
102
+ - test/dummy/config/initializers/cookies_serializer.rb
103
+ - test/dummy/config/initializers/filter_parameter_logging.rb
104
+ - test/dummy/config/application.rb
105
+ - test/dummy/config/routes.rb
108
106
  - test/dummy/config/environments/production.rb
109
107
  - test/dummy/config/environments/test.rb
110
- - test/dummy/config/locales/en.yml
111
- - test/dummy/config/routes.rb
108
+ - test/dummy/config/environments/development.rb
112
109
  - test/dummy/config/secrets.yml
113
- - test/dummy/README.rdoc
114
- - test/dummy/config.ru
115
- - test/dummy/app/controllers/application_controller.rb
110
+ - test/dummy/config/environment.rb
111
+ - test/dummy/config/locales/en.yml
112
+ - test/dummy/config/boot.rb
116
113
  - test/dummy/app/helpers/application_helper.rb
117
114
  - test/dummy/app/views/layouts/application.html.erb
115
+ - test/dummy/app/controllers/application_controller.rb
118
116
  - test/dummy/app/assets/javascripts/application.js
119
117
  - test/dummy/app/assets/stylesheets/application.css
120
- - test/dummy/bin/bundle
121
- - test/dummy/bin/rails
122
- - test/dummy/bin/setup
123
- - test/dummy/bin/rake
118
+ - test/dummy/README.rdoc
119
+ - test/dummy/config.ru
120
+ - test/dummy/Rakefile
121
+ - test/dummy/public/422.html
122
+ - test/dummy/public/favicon.ico
123
+ - test/dummy/public/404.html
124
+ - test/dummy/public/500.html
124
125
  - test/cobracommander_test.rb
125
- - test/test_helper.rb