meta_presenter 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 99961e754b5d811535fd5bcb71babe0a659b81c1
4
+ data.tar.gz: d83a393e92a413e880a74ec65956eac485cb04a5
5
+ SHA512:
6
+ metadata.gz: 79b5e918690bd48e7c96517df3c850007dabcb41116cd05759c2992620d11733ef8634f57ebbe88aea8e892c6b0280c541f37659f454b87bff101432ad9be5ac
7
+ data.tar.gz: aa182dedc0e876cfcb1095260ff6f50f1a96929100514e177c6dd2160bd6baf5cee7110ccfb1d61fc651a6956c75985916357eeb4311ea61a2aeac4401cc76ca
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ cache: bundler
3
+ matrix:
4
+ fast_finish: true
5
+ branches:
6
+ only: master
7
+ rvm:
8
+ - 2.1.0
9
+ - 2.2.0
10
+ - 2.3.0
11
+ - 2.4.0
12
+ script: bundle exec rspec
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in meta_presenter.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2018 szTheory
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,163 @@
1
+ [![Gem Version](https://badge.fury.io/rb/meta_presenter.svg)](https://badge.fury.io/rb/meta_presenter) [![Build Status](https://travis-ci.org/sztheory/meta_presenter.svg?branch=master)](https://travis-ci.org/sztheory/meta_presenter) [![Coverage Status](https://coveralls.io/repos/github/sztheory/meta_presenter/badge.svg?branch=master)](https://coveralls.io/github/sztheory/meta_presenter?branch=master) [![Inline docs](http://inch-ci.org/github/sztheory/meta_presenter.svg?branch=master)](http://inch-ci.org/github/sztheory/meta_presenter) [![MIT License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/sztheory/meta_presenter/blob/master/LICENSE.txt) [![Gem](https://img.shields.io/gem/dt/meta_presenter.svg)](https://rubygems.org/gems/meta_presenter) [![GitHub stars](https://img.shields.io/github/stars/sztheory/meta_presenter.svg?label=Stars&style=social)](https://github.com/sztheory/meta_presenter)
2
+
3
+ # MetaPresenter
4
+
5
+ MetaPresenter is a Ruby gem that gives you access to the powerful presenter pattern in your Rails controllers. For each controller/action pair you get a presenter class in `app/presenters` that you can use in your views with with `presenter.method_name`. This helps you decompose your helper logic into small, tight, classes that are easily testable. There's even a DSL for method delegation on objects to reduce boilerplate.
6
+
7
+ [Github Project Page](https://github.com/szTheory/meta_presenter)
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'meta_presenter'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install meta_presenter
22
+
23
+ TODO: add an optional task that generates the scaffolding for you. Or, you can manually create the files you want.
24
+
25
+ Include MetaPresenter::Helpers in your controller or mailer:
26
+
27
+ class ApplicationController < ActionController::Base
28
+ include MetaPresenter::Helpers
29
+ end
30
+
31
+ class ApplicationMailer < ActionMailer::Base
32
+ include MetaPresenter::Helpers
33
+ end
34
+
35
+ ## Usage Example
36
+
37
+ Say you have a PagesController with an action for home and logs. Underneath `app/presenters` you can add a class for each action. In this example we'll also create an application and base presenter we'll inherit from to re-use code in the per-action presenters.
38
+
39
+ app/
40
+ controllers/
41
+ application_controller.rb
42
+ pages_controller.rb
43
+ presenters/
44
+ application_presenter.rb
45
+ pages/
46
+ base_presenter.rb
47
+ home_presenter.rb
48
+ logs_presenter.rb
49
+
50
+ app/controllers/page_controller.rb
51
+
52
+ class ApplicationController < ActionController::Base
53
+ # Controller methods automatically become available in views and other presenters.
54
+ # So this gives you presenter.current_user in views, and you can call `current_user`
55
+ # within your presenters as well
56
+ def current_user
57
+ User.first
58
+ end
59
+ end
60
+
61
+ app/controllers/dashboard_controller.rb
62
+
63
+ class ApplicationController < ActionController::Base
64
+ def home
65
+ end
66
+
67
+ def logs
68
+ end
69
+
70
+ private
71
+ # presenter.logs in views
72
+ def logs
73
+ Log.all
74
+ end
75
+ end
76
+
77
+ app/presenters/application_presenter.rb
78
+
79
+ class ApplicationPresenter < MetaPresenter::BasePresenter
80
+ # Makes presenter.page_title available in all of your app's views
81
+ def page_title
82
+ "My App"
83
+ end
84
+
85
+ # presenter.last_login_at in views
86
+ def last_login_at
87
+ # controller methods from within the same scope
88
+ # as the presenter are directly available
89
+ current_user.last_login_at
90
+ end
91
+ end
92
+
93
+ app/presenters/pages/base_presenter.rb:
94
+
95
+ class Pages::BasePresenter < ApplicationPresenter
96
+ # Makes presenter.nav_items available for
97
+ # all actions on PagesController
98
+ def nav_items
99
+ [
100
+ {name: "Home", path: home_path},
101
+ {name: "Logs", path: logs_path}
102
+ ]
103
+ end
104
+ end
105
+
106
+ app/presenters/pages/home_presenter.rb
107
+
108
+ class Pages::HomePresenter << Pages::BasePresenter
109
+ # presenter.email, presenter.id
110
+ # or any other method not already defined
111
+ # will delegate to the current_user
112
+ delegate_all_to :current_user
113
+
114
+ # presenter.greeting in views
115
+ def greeting
116
+ "Hello, #{current_user.name}"
117
+ end
118
+ end
119
+
120
+ app/presenters/pages/logs_presenter.rb
121
+
122
+ class Pages::LogsPresenter << Pages::BasePresenter
123
+ # presenter.size and presenter.last will delegate to
124
+ # the controller's private #logs method
125
+ delegate :size, :last, to: :logs
126
+
127
+ # presenter.log_text(log) in view
128
+ # for example in a haml view:
129
+ #
130
+ # - presenter.logs.each do |log|
131
+ # = presenter.log_text(log)
132
+ #
133
+ def log_text(log)
134
+ log.description
135
+ end
136
+ end
137
+
138
+ TODO: add more documentation around layout presenters
139
+
140
+ ## Aliasing the presenter methods
141
+
142
+ If you want to customize the `presenter` and `layout_presenter` methods you can specify a shorthand by adding an alias_method to your controller or mailer:
143
+
144
+ class ApplicationController < ActionController::Base
145
+ including MetaPresenter
146
+
147
+ # So convenient!
148
+ alias_method :presenter, :p
149
+ alias_method :presenter, :lp
150
+ end
151
+
152
+ ## Contributing
153
+
154
+ 1. Fork it
155
+ 2. Create your feature branch (`git checkout -b feature/my-new-feature`) or bugfix branch (`git checkout -b bugfix/my-helpful-bugfix`)
156
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
157
+ 4. Push to the branch (`git push origin feature/my-new-feature`)
158
+ 5. Make sure specs are passing (`bundle exec rspec`)
159
+ 6. Create new Pull Request
160
+
161
+ ## License
162
+
163
+ See the [LICENSE](https://github.com/szTheory/meta_presenter/blob/master/LICENSE.txt) file.
@@ -0,0 +1,5 @@
1
+ require 'meta_presenter/helpers'
2
+ require 'meta_presenter/base'
3
+
4
+ module MetaPresenter
5
+ end
@@ -0,0 +1,25 @@
1
+ require_relative 'base/delegate_all_to.rb'
2
+ require_relative 'base/delegate_to_controller.rb'
3
+
4
+ # Base presenter class. Inherit from this it in order
5
+ # to get a presenter you can use in your views
6
+ #
7
+ # # app/presenters/application_presenter.rb
8
+ # class ApplicationPresenter < MetaPresenter::Base
9
+ # def message
10
+ # "Hello"
11
+ # end
12
+ # end
13
+ #
14
+ module MetaPresenter
15
+ class Base
16
+ include DelegateToController
17
+ # Comes last so `delegate_all_to` takes priority
18
+ # over default controller actions
19
+ include DelegateAllTo
20
+
21
+ def inspect
22
+ "#<#{self.class.name}>"
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,56 @@
1
+ require 'active_support/concern'
2
+
3
+ module MetaPresenter
4
+ class Base
5
+ module DelegateAllTo
6
+ extend ActiveSupport::Concern
7
+ included do
8
+ class_attribute :delegate_all_to
9
+ attr_accessor :delegating
10
+ include InstanceMethods
11
+ end
12
+
13
+ module InstanceMethods
14
+ def respond_to_missing?(*args)
15
+ method_name = args.first
16
+ delegate_all_responds_to?(method_name) || super
17
+ end
18
+
19
+ private
20
+ def delegate_all_responds_to?(method_name)
21
+ delegate_all_to? && delegate_all_to.respond_to?(method_name)
22
+ end
23
+
24
+ # Use metaprogramming to delegate all methods
25
+ def method_missing(method_name, *args, &block)
26
+ # If `delegate_all_to` has been set up for the method name
27
+ # then delegate to it, otherwise pass it up the food chain
28
+ if !delegating_all_to? && delegate_all_responds_to?(method_name)
29
+ delegate_all_to.send(method_name, *args, &block)
30
+ else
31
+ super
32
+ end
33
+ end
34
+
35
+ def delegate_all_to
36
+ # Temporarily set a flag that we are delegating
37
+ # to an underlying method. this allows us
38
+ # to chain additional methods calls onto the end
39
+ delegating = true
40
+ send(self.class.delegate_all_to)
41
+ ensure
42
+ # Cleanup the flag afterwards to close the door behind us
43
+ delegating = false
44
+ end
45
+
46
+ def delegating_all_to?
47
+ delegating == true
48
+ end
49
+
50
+ def delegate_all_to?
51
+ self.class.delegate_all_to.present?
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,39 @@
1
+ require 'active_support/concern'
2
+
3
+ module MetaPresenter
4
+ class Base
5
+ module DelegateToController
6
+ INCLUDE_PRIVATE_METHODS = true
7
+
8
+ extend ActiveSupport::Concern
9
+ included do
10
+ attr_reader :controller
11
+ include InstanceMethods
12
+ end
13
+
14
+ module InstanceMethods
15
+ def initialize(controller)
16
+ @controller = controller
17
+ end
18
+
19
+ def respond_to_missing?(*args)
20
+ method_name = args.first
21
+ delegates_controller_method? || super
22
+ end
23
+
24
+ private
25
+ def delegates_controller_method?(method_name)
26
+ controller.respond_to?(method_name, INCLUDE_PRIVATE_METHODS)
27
+ end
28
+
29
+ def method_missing(method_name, *args, &block)
30
+ if delegates_controller_method?(method_name)
31
+ controller.send(method_name, *args, &block)
32
+ else
33
+ super
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,89 @@
1
+ module MetaPresenter
2
+ class Builder
3
+ attr_reader :controller, :action_name
4
+ def initialize(controller, action_name)
5
+ @controller = controller
6
+ @action_name = action_name
7
+ end
8
+
9
+ def presenter_class
10
+ # Try to find the class (it's not guaranteed)
11
+ klass_name = ancestors.find do |klass_name|
12
+ presenter_class_for(klass_name)
13
+ end
14
+
15
+ # Return the actual class
16
+ presenter_class_for(klass_name)
17
+ end
18
+
19
+ private
20
+ def all_ancestors
21
+ controller.class.ancestors
22
+ end
23
+
24
+ def mailer_ancestors
25
+ ancestors_until(ApplicationMailer) do |klass|
26
+ "Mailers::#{klass.name.gsub('Mailer', '')}"
27
+ end
28
+ end
29
+
30
+ def controller_ancestors
31
+ ancestors_until(ApplicationController) do |klass|
32
+ klass.try(:name).try(:gsub, 'Controller', '')
33
+ end
34
+ end
35
+
36
+ def presenter_class_for(klass_name)
37
+ presenter_class_name = "::#{klass_name}Presenter"
38
+ begin
39
+ presenter_class_name.constantize
40
+
41
+ # No corresponding presenter class was found
42
+ rescue NameError => e
43
+ filename = "#{presenter_class_name.underscore}.rb"
44
+ presenter_file_path = File.join(Rails.root, "app", "presenters", filename)
45
+ if File.exists?(presenter_file_path)
46
+ # If the file exists, but the class isn't defined then something
47
+ # has gone wrong that the dev really should know about!
48
+ raise e
49
+ else
50
+ false
51
+ end
52
+ end
53
+ end
54
+
55
+ def ancestors
56
+ all_ancestors.yield_self do |list|
57
+ # Different ancestors depending on whether
58
+ # we're dealing with a mailer or a controller
59
+ if list.include?(ActionMailer::Base)
60
+ mailer_ancestors
61
+ else
62
+ controller_ancestors
63
+ end
64
+ end.yield_self do |list|
65
+ # add a presenter class for our current action
66
+ # to the front of the list
67
+ presenter_class_name_for_current_action = "#{list.first}::#{action_name.camelcase}"
68
+ list.unshift(presenter_class_name_for_current_action)
69
+ end
70
+ end
71
+
72
+ # The list of ancestors is very long.
73
+ # Trim it down to just the length of the class we are looking for.
74
+ #
75
+ # Takes an optional block method to transform the result
76
+ # with a map operation
77
+ def ancestors_until(until_class)
78
+ # trim down the list
79
+ ancestors_list = all_ancestors[0..all_ancestors.index(until_class)]
80
+
81
+ # map to the fully qualified class name
82
+ if block_given?
83
+ ancestors_list.map { |klass| yield(klass) }
84
+ else
85
+ ancestors_list
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,40 @@
1
+ require 'meta_presenter/builder'
2
+ require 'meta_presenter/layout_builder'
3
+ require 'active_support/concern'
4
+
5
+ module MetaPresenter
6
+ module Helpers
7
+ extend ActiveSupport::Concern
8
+ included do
9
+ # Sets up the `presenter.` method as helper within your views
10
+ # If you want to customize this for yourslef just alias_method it
11
+ helper_method :presenter
12
+
13
+ # Sets up the `layout_presenter.` method as helper within your views
14
+ # If you want to customize this for yourslef just alias_method it
15
+ helper_method :layout_presenter
16
+ end
17
+
18
+ private
19
+ # Initialize presenter with the current controller
20
+ def presenter
21
+ @presenter ||= begin
22
+ yield_self do |controller|
23
+ klass = MetaPresenter::Builder.new(controller, action_name).presenter_class
24
+ klass.new(controller)
25
+ end
26
+ end
27
+ end
28
+
29
+ # Initialize presenter with the current controller
30
+ def layout_presenter
31
+ @layout_presenters ||= {}
32
+ @layout_presenters[current_layout] ||= begin
33
+ yield_self do |controller|
34
+ klass = MetaPresenter::LayoutBuilder.new(current_layout, layouts).layout_presenter_class
35
+ klass.new(controller)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,54 @@
1
+ module MetaPresenter
2
+ class LayoutBuilder
3
+ class NoLayoutImplemented < NotImplementedError
4
+ def initialize(current_layout, layouts)
5
+ super("No layout presenter definition found for #{current_layout} among #{layouts}")
6
+ end
7
+ end
8
+
9
+ attr_reader :layouts, :current_layout
10
+ def initialize(layouts, current_layout)
11
+ @layouts = layouts
12
+ @current_layout = current_layout
13
+ end
14
+
15
+ def layout_presenter_class
16
+ return nil if layout_index.nil?
17
+
18
+ layout_classes(layout_index).find do |klass_name|
19
+ layout_presenter_class_for(klass_name)
20
+ end.tap do |klass|
21
+ if klass.blank?
22
+ raise NoLayoutImplemented.new(current_layout, layouts)
23
+ end
24
+ end
25
+ end
26
+
27
+ private
28
+ def layout_presenter_class_for(klass_name)
29
+ layout_presenter_class_name = "Layouts::#{klass_name.camelcase}Presenter"
30
+ begin
31
+ layout_presenter_class_name.constantize
32
+
33
+ # No corresponding presenter class was found
34
+ rescue NameError => e
35
+ layout_presenter_file_path = Rails.root.join("app", "presenters", "layouts", "#{layout_presenter_class_name.underscore}.rb")
36
+ if File.exists?(layout_presenter_file_path)
37
+ # If the file exists, but the class isn't defined then something
38
+ # has gone wrong that the dev really should know about!
39
+ raise e
40
+ else
41
+ false
42
+ end
43
+ end
44
+ end
45
+
46
+ def layout_index
47
+ layouts.index(current_layout)
48
+ end
49
+
50
+ def layout_classes
51
+ layouts[0..layout_index].reverse
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'meta_presenter'
5
+ spec.version = '0.1.0'
6
+ spec.authors = ['szTheory']
7
+ spec.description = %q{Presenter pattern in your Rails controllers and actions}
8
+ spec.summary = %q{MetaPresenter is a Ruby gem that gives you access to the powerful presenter pattern in your Rails controllers. For each controller/action pair you get a presenter class in `app/presenters` that you can use in your views with with `presenter.method_name`. This helps you decompose your helper logic into small, tight, classes that are easily testable. There's even a DSL for method delegation on objects to reduce boilerplate.}
9
+ spec.homepage = 'https://github.com/szTheory/meta_presenter'
10
+ spec.license = 'MIT'
11
+ spec.metadata = {
12
+ "source_code_uri" => "https://github.com/szTheory/meta_presenter",
13
+ }
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.add_runtime_dependency 'actionpack', '>= 3.0'
21
+ spec.add_runtime_dependency 'actionmailer', '>= 3.0'
22
+
23
+ spec.add_development_dependency 'rspec'
24
+ spec.add_development_dependency 'database_cleaner'
25
+ spec.add_development_dependency 'bundler'
26
+ spec.add_development_dependency 'rake'
27
+ spec.add_development_dependency 'pry'
28
+ spec.add_development_dependency 'coveralls'
29
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe MetaPresenter do
4
+
5
+ end
@@ -0,0 +1,6 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
4
+ require "meta_presenter"
5
+ require "database_cleaner"
6
+ require "support/database_cleaner"
@@ -0,0 +1,17 @@
1
+ RSpec.configure do |config|
2
+ config.before(:suite) do
3
+ DatabaseCleaner.clean_with(:truncation)
4
+ end
5
+
6
+ config.before(:each) do
7
+ DatabaseCleaner.strategy = :transaction
8
+ end
9
+
10
+ config.before(:each) do
11
+ DatabaseCleaner.start
12
+ end
13
+
14
+ config.after(:each) do
15
+ DatabaseCleaner.clean
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,179 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: meta_presenter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - szTheory
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-11-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: actionpack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: actionmailer
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: database_cleaner
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: coveralls
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: Presenter pattern in your Rails controllers and actions
126
+ email:
127
+ executables: []
128
+ extensions: []
129
+ extra_rdoc_files: []
130
+ files:
131
+ - ".gitignore"
132
+ - ".travis.yml"
133
+ - Gemfile
134
+ - LICENSE.txt
135
+ - README.md
136
+ - lib/meta_presenter.rb
137
+ - lib/meta_presenter/base.rb
138
+ - lib/meta_presenter/base/delegate_all_to.rb
139
+ - lib/meta_presenter/base/delegate_to_controller.rb
140
+ - lib/meta_presenter/builder.rb
141
+ - lib/meta_presenter/helpers.rb
142
+ - lib/meta_presenter/layout_builder.rb
143
+ - meta_presenter.gemspec
144
+ - spec/meta_presenter_spec.rb
145
+ - spec/spec_helper.rb
146
+ - spec/support/database_cleaner.rb
147
+ homepage: https://github.com/szTheory/meta_presenter
148
+ licenses:
149
+ - MIT
150
+ metadata:
151
+ source_code_uri: https://github.com/szTheory/meta_presenter
152
+ post_install_message:
153
+ rdoc_options: []
154
+ require_paths:
155
+ - lib
156
+ required_ruby_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ required_rubygems_version: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ requirements: []
167
+ rubyforge_project:
168
+ rubygems_version: 2.6.11
169
+ signing_key:
170
+ specification_version: 4
171
+ summary: MetaPresenter is a Ruby gem that gives you access to the powerful presenter
172
+ pattern in your Rails controllers. For each controller/action pair you get a presenter
173
+ class in `app/presenters` that you can use in your views with with `presenter.method_name`.
174
+ This helps you decompose your helper logic into small, tight, classes that are easily
175
+ testable. There's even a DSL for method delegation on objects to reduce boilerplate.
176
+ test_files:
177
+ - spec/meta_presenter_spec.rb
178
+ - spec/spec_helper.rb
179
+ - spec/support/database_cleaner.rb