lev 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lev (0.0.2)
4
+ lev (0.0.3)
5
5
  active_attr
6
6
  transaction_isolation
7
7
  transaction_retry
@@ -20,18 +20,23 @@ module Lev
20
20
  # handle_with takes care of calling the handler and populates
21
21
  # @errors and @results objects with the return values from the handler
22
22
  #
23
+ #
23
24
  # The 'success' and 'failure' lambdas are called if there aren't or are errors,
24
25
  # respectively. Alternatively, if you supply a 'complete' lambda, that lambda
25
- # will be called regardless of whether there are any errors.
26
+ # will be called regardless of whether there are any errors. Inside these lambdas
27
+ # (and inside the views they connect to), there will be @errors and @results
28
+ # variables containing the errors and results from the handler.
26
29
  #
27
30
  # Specifying 'params' is optional. If you don't specify it, HandleWith will
28
31
  # use the entire params hash from the request.
29
32
  #
30
33
  module HandleWith
31
34
  def handle_with(handler, options)
32
- success_action = options.delete(:success) || lambda {}
33
- failure_action = options.delete(:failure) || lambda {}
34
- complete_action = options.delete(:complete) || lambda {}
35
+ success_action = options.delete(:success)
36
+ failure_action = options.delete(:failure)
37
+ complete_action = options.delete(:complete)
38
+
39
+ complete_action ||= lambda { render } if !(success_action || failure_action)
35
40
 
36
41
  options[:params] ||= params
37
42
  options[:request] ||= request
data/lib/lev/handler.rb CHANGED
@@ -60,7 +60,14 @@ module Lev
60
60
  # 2) 'caller' -- the user submitting the input
61
61
  # 3) 'errors' -- an object in which to store errors
62
62
  # 4) 'results' -- a hash in which to store results for return to calling code
63
+ # 5) 'options' -- a hash containing the options passed in, useful for other
64
+ # nonstandard data.
63
65
  #
66
+ # Handler 'exec' methods don't return anything; they just set values in
67
+ # the errors and results objects. The documentation for each handler
68
+ # should explain what the results will be and any nonstandard data required
69
+ # to be passed in in the options.
70
+ #
64
71
  # See the documentation for Lev::RoutineNesting about other requirements and
65
72
  # capabilities of handler classes.
66
73
  #
data/lib/lev/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lev
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lev
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-18 00:00:00.000000000 Z
12
+ date: 2013-09-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: transaction_isolation
@@ -140,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
140
  version: '0'
141
141
  segments:
142
142
  - 0
143
- hash: -199634686570320863
143
+ hash: 3785122561258895642
144
144
  required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  none: false
146
146
  requirements:
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  version: '0'
150
150
  segments:
151
151
  - 0
152
- hash: -199634686570320863
152
+ hash: 3785122561258895642
153
153
  requirements: []
154
154
  rubyforge_project:
155
155
  rubygems_version: 1.8.25