short_circuit 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,9 +1,7 @@
1
- short-circuit
1
+ short_circuit [![Build Status](https://travis-ci.org/jpruetting/short_circuit.png?branch=master)](https://travis-ci.org/jpruetting/short_circuit)
2
2
  =============
3
3
 
4
- [![Build Status](https://travis-ci.org/jpruetting/short-circuit.png?branch=master)](https://travis-ci.org/jpruetting/short-circuit)
5
-
6
- Short Circuit enables simple presenters for Rails views.
4
+ Short Circuit adds simple presenters for Rails views.
7
5
 
8
6
 
9
7
  Installation
@@ -12,7 +10,7 @@ Installation
12
10
  Include the gem in your Gemfile:
13
11
 
14
12
  ```ruby
15
- gem 'short-circuit'
13
+ gem 'short_circuit'
16
14
  ```
17
15
 
18
16
  Usage
@@ -82,3 +80,10 @@ Examples:
82
80
 
83
81
  @user.present! :not_a_real_method # NoMethodError
84
82
  ```
83
+
84
+ Design Decisions
85
+ =============
86
+ * All presenter methods are accessed via 'present' and 'present!'. This helps identify whether the output is coming from the presenter or directly from the model. It also keeps intact the familiar and direct access to a model's attributes.
87
+ * The 'present' method will fail silently. This keeps minor accessor errors from breaking an entire page. Errors can still be logged/handled via the 'error_response' method.
88
+ * If you do not want a particular method call to fail silently, the 'present!' method will throw errors as usual.
89
+ * If a method is not found on the presenter, it will delegate the call to the model.
@@ -7,8 +7,8 @@ module ShortCircuit
7
7
  def present(method, *args, &block)
8
8
  begin
9
9
  present!(method, *args, &block)
10
- rescue
11
- presenter.error_response(method, *args, &block)
10
+ rescue Exception => error
11
+ presenter.error_response(error, method, *args, &block)
12
12
  end
13
13
  end
14
14
 
@@ -13,7 +13,7 @@ module ShortCircuit
13
13
  ApplicationController.helpers
14
14
  end
15
15
 
16
- def error_response(method, *args, &block)
16
+ def error_response(error, method, *args, &block)
17
17
  ''
18
18
  end
19
19
 
@@ -1,3 +1,3 @@
1
1
  module ShortCircuit
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: short_circuit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
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-05-28 00:00:00.000000000 Z
12
+ date: 2013-06-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -59,7 +59,7 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
- description: Short Circuit enables simple presenters for Rails views.
62
+ description: Short Circuit adds simple presenters for Rails views.
63
63
  email:
64
64
  - jim@roboticmethod.com}
65
65
  executables: []
@@ -108,7 +108,7 @@ files:
108
108
  - spec/dummy/script/rails
109
109
  - spec/short_circuit/presentable_spec.rb
110
110
  - spec/spec_helper.rb
111
- homepage: http://www.roboticmethod.com
111
+ homepage: https://github.com/jpruetting/short_circuit
112
112
  licenses: []
113
113
  post_install_message:
114
114
  rdoc_options: []