prospecto 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -23,25 +23,27 @@ There are 2 problems that prospecto was created to solve.
23
23
  1. Views are hard and ineffective to test.
24
24
  2. Code is often common between the output formats.
25
25
 
26
- We feel that (our interpretation of) the presenter pattern is the answer to these problems. To be clear, you
27
- do not need a library to implement the presenter pattern. The purpose of prospecto is to provide some syntactic
28
- sugar and structure.
26
+ We feel that (our interpretation of) the presenter pattern is the answer to
27
+ these problems. To be clear, you do not need a library to implement the
28
+ presenter pattern. The purpose of prospecto is to provide some syntactic sugar
29
+ and structure.
29
30
 
30
31
  ## Usage
31
32
 
32
33
  ### ApplicationPresenter
33
34
 
34
- To start it is recommended (but not required) that you generate an `ApplicationPresenter`. This will act
35
- as a base class for all other presenters much like an `ApplicationController`. Just use the built in
36
- generator:
35
+ To start it is recommended (but not required) that you generate an
36
+ `ApplicationPresenter`. This will act as a base class for all other presenters
37
+ much like an `ApplicationController`. Just use the built in generator:
37
38
 
38
39
  $ rails generate prospecto:install
39
40
 
40
41
  ### Presenter
41
42
 
42
- You are now ready to start creating presenters. In prospecto a presenter does not necessarily correlate with
43
- a model (though this often ends up as the case), instead a presenter represents a view or family of views
44
- depending on the situation. This is up to you to decide.
43
+ You are now ready to start creating presenters. In prospecto a presenter does
44
+ not necessarily correlate with a model (though this often ends up as the case),
45
+ instead a presenter represents a view or family of views depending on the
46
+ situation. This is up to you to decide.
45
47
 
46
48
  To create a simple presenter use the included generator:
47
49
 
@@ -49,8 +51,9 @@ To create a simple presenter use the included generator:
49
51
 
50
52
  ### Prospecto::PresenterView
51
53
 
52
- By default all presenters inherit from the `Prospecto::PresenterView` class. This class is optional and exists
53
- solely to provide some sugar for creating constructors for objects.
54
+ By default all presenters inherit from the `Prospecto::PresenterView` class.
55
+ This class is optional and exists solely to provide some sugar for creating
56
+ constructors for objects.
54
57
 
55
58
  #### accepts
56
59
 
@@ -73,8 +76,8 @@ puts user.name
73
76
  #### decorates
74
77
 
75
78
  The `decorates` method allows the provided value to be accessed directly on the
76
- presenter. This is simalar to how something like [draper](https://github.com/jcasimir/draper)
77
- works.
79
+ presenter. This is simalar to how something like
80
+ [draper](https://github.com/jcasimir/draper) works.
78
81
 
79
82
  ``` ruby
80
83
  class UserPresenter < Prospecto::PresenterView
@@ -87,7 +90,8 @@ puts "#{view.first} #{view.last}"
87
90
 
88
91
  #### proxies
89
92
 
90
- The `proxies` method creates named methods on the presenter for the provided value.
93
+ The `proxies` method creates named methods on the presenter for the provided
94
+ value.
91
95
 
92
96
  ``` ruby
93
97
  class UserPresenter < Prospecto::PresenterView
@@ -114,9 +118,9 @@ puts "#{view.user_public.first} #{view.user_public.last}"
114
118
 
115
119
  ### Rails Views and Controllers
116
120
 
117
- How you use the presenters is very loose. Since you are just dealing with pretty vanilla
118
- ruby objects you can instantiate where it makes the most sense for your project. Usually
119
- basic usage looks something like this.
121
+ How you use the presenters is very loose. Since you are just dealing with
122
+ pretty vanilla ruby objects you can instantiate where it makes the most sense
123
+ for your project. Usually basic usage looks something like this.
120
124
 
121
125
  ``` ruby
122
126
  class UserController < ApplicationController
@@ -139,5 +143,5 @@ You then use the `@view` object like normal in the view.
139
143
 
140
144
  ## Sponsor
141
145
 
142
- Development for prospecto is sponsored mainly by my employer [Voonami](http://www.voonami.com)
143
- since we use it heavily in house.
146
+ Development for prospecto is sponsored mainly by my employer
147
+ [Voonami](http://www.voonami.com) since we use it heavily in house.
@@ -24,9 +24,9 @@ module Prospecto
24
24
  def method_missing(name, *args, &block)
25
25
  if property_name = self.class.__properties.find{|m| name.to_s.start_with? "#{m}_"}
26
26
  field_name = name.to_s.sub("#{property_name}_", "")
27
- self.send(property_name).send(field_name)
27
+ self.send(property_name).send(field_name, *args, &block)
28
28
  elsif delegate_obj = __delegates.find{|d| d.respond_to? name}
29
- delegate_obj.send(name)
29
+ delegate_obj.send(name, *args, &block)
30
30
  else
31
31
  super
32
32
  end
@@ -1,5 +1,5 @@
1
1
  # Main Prospecto namespace.
2
2
  module Prospecto
3
3
  # The current Prospecto version.
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prospecto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-20 00:00:00.000000000 Z
12
+ date: 2012-06-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70113014264460 !ruby/object:Gem::Requirement
16
+ requirement: &70201111619740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70113014264460
24
+ version_requirements: *70201111619740
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70113014263760 !ruby/object:Gem::Requirement
27
+ requirement: &70201111618300 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,18 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70113014263760
36
- - !ruby/object:Gem::Dependency
37
- name: pry
38
- requirement: &70113014262840 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
43
- version: '0'
44
- type: :development
45
- prerelease: false
46
- version_requirements: *70113014262840
35
+ version_requirements: *70201111618300
47
36
  description: ''
48
37
  email:
49
38
  - bigjasonwebb@gmail.com
@@ -81,7 +70,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
70
  version: '0'
82
71
  segments:
83
72
  - 0
84
- hash: -2544824161487180405
73
+ hash: 3769703894804639949
85
74
  required_rubygems_version: !ruby/object:Gem::Requirement
86
75
  none: false
87
76
  requirements:
@@ -90,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
79
  version: '0'
91
80
  segments:
92
81
  - 0
93
- hash: -2544824161487180405
82
+ hash: 3769703894804639949
94
83
  requirements: []
95
84
  rubyforge_project:
96
85
  rubygems_version: 1.8.10