magic-presenter 1.1.1 → 1.3.0
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 +4 -4
- data/README.md +36 -32
- data/Rakefile +0 -1
- data/app/models/concerns/magic/presentable/active_record_collection.rb +15 -0
- data/app/models/concerns/magic/presentable/collection.rb +19 -0
- data/app/models/concerns/magic/presentable.rb +4 -9
- data/config/initializers/action_view.rb +11 -1
- data/config/initializers/generators.rb +1 -1
- data/config/initializers/presentable.rb +4 -0
- data/lib/generators/magic/presenter/generator.rb +1 -1
- data/lib/magic/presenter/authors.rb +5 -1
- data/lib/magic/presenter/base.rb +27 -21
- data/lib/magic/presenter/collection.rb +36 -0
- data/lib/magic/presenter/engine.rb +1 -3
- data/lib/magic/presenter/helpers.rb +6 -7
- data/lib/magic/presenter/test_case.rb +1 -1
- data/lib/magic/presenter/version.rb +1 -1
- data/lib/magic/presenter.rb +7 -17
- data/lib/rspec/rails/example/presenter_example_group.rb +1 -1
- metadata +108 -109
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0336dc17e983771f6f96385c14429c66e961614ee20f1c99202ab92e970e8663
|
|
4
|
+
data.tar.gz: c923d4f65d8772b8fa52dd62c5d26a0d7b5e96f9d1b3ac12af28296dfb80547b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 94be4b679d87564d79169e919f2e5abb400971b82c0ad78d5456aedbde969e1b4574b27569dee9011861fb899637e3f5394cebfe84488a68063254b70eb7a5a7
|
|
7
|
+
data.tar.gz: 32b20c180e447a2164013d595256c12b8019a5143595d547373c82b157757bea3cf5867248d7068d1d36786e79cd0b6873d6cd814f8f760b53a990c25ed3a924
|
data/README.md
CHANGED
|
@@ -3,11 +3,15 @@
|
|
|
3
3
|

|
|
6
|
-
](
|
|
9
|
+
https://qlty.sh/gh/Alexander-Senko/projects/magic-presenter
|
|
8
10
|
)
|
|
9
|
-
](
|
|
14
|
+
https://qlty.sh/gh/Alexander-Senko/projects/magic-presenter
|
|
11
15
|
)
|
|
12
16
|
|
|
13
17
|
A bit of history: this gem was inspired by digging deeper into [Draper](https://github.com/drapergem/draper) with an eye on a refactoring.
|
|
@@ -18,7 +22,7 @@ Based on [Magic Decorator](
|
|
|
18
22
|
|
|
19
23
|
## Installation
|
|
20
24
|
|
|
21
|
-
Install the gem and add to the application
|
|
25
|
+
Install the gem and add to the application’s Gemfile by executing:
|
|
22
26
|
|
|
23
27
|
$ bundle add magic-presenter
|
|
24
28
|
|
|
@@ -60,13 +64,31 @@ When no presenter is found,
|
|
|
60
64
|
- `#decorate!` raises `Magic::Lookup::Error`,
|
|
61
65
|
- `#decorated` returns the original object.
|
|
62
66
|
|
|
67
|
+
#### Collections
|
|
68
|
+
|
|
69
|
+
Active Record relations are presentable as collections. Define a collection presenter inside the matching presenter to customize collection behavior:
|
|
70
|
+
|
|
71
|
+
```ruby
|
|
72
|
+
class PersonPresenter < Magic::Presenter::Base
|
|
73
|
+
collection_presenter do
|
|
74
|
+
def names = map(&:name).to_sentence
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
Person.all.decorated.names
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Under the hood, `.collection_presenter` defines `PersonPresenter::Collection < Magic::Presenter::Collection` in the above example and evaluates the block within that class’ context.
|
|
82
|
+
It looks for a collection presenter class in ancestor classes to be inherited from, up to `Magic::Presenter::Collection`.
|
|
83
|
+
One can also define a collection presenter class explicitly, following the same pattern.
|
|
84
|
+
|
|
63
85
|
### Generators
|
|
64
86
|
|
|
65
87
|
A generator can be used to generate a presenter:
|
|
66
88
|
|
|
67
89
|
$ bin/rails generate presenter Person
|
|
68
90
|
|
|
69
|
-
See the help for more
|
|
91
|
+
See the help for more information:
|
|
70
92
|
|
|
71
93
|
$ bin/rails generate presenter --help
|
|
72
94
|
|
|
@@ -87,7 +109,7 @@ end
|
|
|
87
109
|
```
|
|
88
110
|
|
|
89
111
|
A view context must be set to enable helpers.
|
|
90
|
-
It
|
|
112
|
+
It is done automagically [wherever possible](#view-context).
|
|
91
113
|
However, one can set it explicitly anywhere:
|
|
92
114
|
|
|
93
115
|
```ruby
|
|
@@ -97,15 +119,17 @@ end
|
|
|
97
119
|
```
|
|
98
120
|
|
|
99
121
|
> [!NOTE]
|
|
100
|
-
> A valid `request` may be needed for URL helpers to get host
|
|
122
|
+
> A valid `request` may be needed for URL helpers to get host data.
|
|
101
123
|
|
|
102
124
|
## 🧙 Magic
|
|
103
125
|
|
|
104
126
|
> [!IMPORTANT]
|
|
105
|
-
> It
|
|
127
|
+
> It is based on [Magic Decorator](
|
|
106
128
|
> https://github.com/Alexander-Senko/magic-decorator#magic
|
|
107
129
|
> ), so get familiar with that one as well.
|
|
108
130
|
|
|
131
|
+
In short, the phylosophy is: _**define presenters you need and expect them to be applied automagically to all the corresponding objects** in every appropriate (view) context_.
|
|
132
|
+
|
|
109
133
|
### Presentable scope
|
|
110
134
|
|
|
111
135
|
`Magic::Presentable` is mixed into `ActiveModel::API` by default.
|
|
@@ -127,7 +151,7 @@ When missing, it further looks for presenters for its ancestor classes, up to `O
|
|
|
127
151
|
- `MyRecord` → `MyPresenter`
|
|
128
152
|
|
|
129
153
|
> [!TIP]
|
|
130
|
-
> That
|
|
154
|
+
> That is why `ApplicationPresenter` presents `ApplicationRecord` alongside all its descendants automagically with no extra code.
|
|
131
155
|
|
|
132
156
|
When in doubt, one can use `Magic::Presenter.name_for`:
|
|
133
157
|
|
|
@@ -135,27 +159,6 @@ When in doubt, one can use `Magic::Presenter.name_for`:
|
|
|
135
159
|
Magic::Presenter.name_for Person # => "PersonPresenter"
|
|
136
160
|
```
|
|
137
161
|
|
|
138
|
-
#### Preloading
|
|
139
|
-
|
|
140
|
-
> [!NOTE]
|
|
141
|
-
> Magic Lookup doesn’t try to autoload any classes, it searches among already loaded ones instead.
|
|
142
|
-
> Thus, presenters should be preloaded to be visible via [lookups](#presenter-class-inference).
|
|
143
|
-
|
|
144
|
-
This is done automatically in both _test_ and _production_ environments by Rails.
|
|
145
|
-
All the application’s presenters and models are eagerly loaded before normal and reverse lookups by Magic Presenter as well.
|
|
146
|
-
So, normally one shouldn’t worry about that.
|
|
147
|
-
|
|
148
|
-
> [!IMPORTANT]
|
|
149
|
-
> When developing a Rails engine that defines its own presenters, one should take care of the preloading themselves.
|
|
150
|
-
|
|
151
|
-
That could be done in an initializer with a helper method provided:
|
|
152
|
-
|
|
153
|
-
```ruby
|
|
154
|
-
Rails.application.config.to_prepare do
|
|
155
|
-
Magic.eager_load :presenters, engine: MyLib::Engine
|
|
156
|
-
end
|
|
157
|
-
```
|
|
158
|
-
|
|
159
162
|
### Class methods delegation
|
|
160
163
|
|
|
161
164
|
Missing class methods of a presenter are delegated to a matching model class if the latter can be inferred unambiguously.
|
|
@@ -166,6 +169,7 @@ Missing class methods of a presenter are delegated to a matching model class if
|
|
|
166
169
|
> [!NOTE]
|
|
167
170
|
> Every object passed to views is decorated automagically.
|
|
168
171
|
> This involves both implicit instance variables and `locals` passed explicitly.
|
|
172
|
+
> Controller helper methods are also decorated when called from views.
|
|
169
173
|
|
|
170
174
|
### Helpers
|
|
171
175
|
|
|
@@ -232,4 +236,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
232
236
|
|
|
233
237
|
## Code of Conduct
|
|
234
238
|
|
|
235
|
-
Everyone interacting in the Magic Presenter project
|
|
239
|
+
Everyone interacting in the Magic Presenter project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Alexander-Senko/magic-presenter/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Magic
|
|
4
|
+
module Presentable
|
|
5
|
+
# = Presentable Active Record relation
|
|
6
|
+
#
|
|
7
|
+
# A tiny wrapper around `Presentable::Collection` for Active Record
|
|
8
|
+
# relations.
|
|
9
|
+
module ActiveRecordCollection
|
|
10
|
+
include Collection
|
|
11
|
+
|
|
12
|
+
def model_class = model
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Magic
|
|
4
|
+
module Presentable
|
|
5
|
+
# = Presentable collection
|
|
6
|
+
#
|
|
7
|
+
# This module includes `Magic::Decoratable` and allows a descendant
|
|
8
|
+
# to be decorated by collection presenters only. Presenter class is
|
|
9
|
+
# being inferred automatically from a collection’s model class.
|
|
10
|
+
module Collection
|
|
11
|
+
include Decoratable
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
def decorator = decorator_base.for model_class
|
|
16
|
+
def decorator_base = Presenter::Collection
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Magic
|
|
4
|
+
# = Presentable object
|
|
5
|
+
#
|
|
4
6
|
# This module includes `Magic::Decoratable` and allows a descendant
|
|
5
7
|
# to be decorated by presenters only. Presenter class is being
|
|
6
8
|
# inferred automatically.
|
|
7
9
|
module Presentable
|
|
8
10
|
include Decoratable
|
|
9
|
-
|
|
10
|
-
class << self
|
|
11
|
-
def classes
|
|
12
|
-
Magic.eager_load :models
|
|
13
|
-
|
|
14
|
-
super
|
|
15
|
-
end
|
|
16
|
-
end
|
|
11
|
+
include Lookup::Scope[:model]
|
|
17
12
|
|
|
18
13
|
private
|
|
19
14
|
|
|
20
|
-
def decorator_base = Presenter
|
|
15
|
+
def decorator_base = Presenter::Base
|
|
21
16
|
end
|
|
22
17
|
end
|
|
@@ -22,6 +22,16 @@ ActiveSupport.on_load :action_view do # rubocop:disable Metrics/BlockLength
|
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
concerning :DecoratedHelpers, prepend: true do
|
|
26
|
+
require 'magic/decorator/core_ext/module'
|
|
27
|
+
|
|
28
|
+
def assign_controller controller
|
|
29
|
+
super
|
|
30
|
+
|
|
31
|
+
self.class.decorated_method controller._helper_methods
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
25
35
|
concerning :PresenterContext, prepend: true do
|
|
26
36
|
def in_rendering_context(...)
|
|
27
37
|
Magic::Presenter.with view_context: self do
|
|
@@ -35,7 +45,7 @@ ActiveSupport.on_load :action_view do # rubocop:disable Metrics/BlockLength
|
|
|
35
45
|
super
|
|
36
46
|
.each_value
|
|
37
47
|
.grep(Magic::Presenter::Base)
|
|
38
|
-
.each {
|
|
48
|
+
.each { it.view_context = self }
|
|
39
49
|
end
|
|
40
50
|
end
|
|
41
51
|
end
|
data/lib/magic/presenter/base.rb
CHANGED
|
@@ -18,39 +18,45 @@ module Magic
|
|
|
18
18
|
include GlobalID if defined? ::GlobalID
|
|
19
19
|
prepend Helpers if defined? ::ActionView
|
|
20
20
|
|
|
21
|
+
Collection = Collection # for lookup
|
|
22
|
+
|
|
21
23
|
class << self
|
|
22
24
|
def name_for object_class
|
|
23
25
|
object_class
|
|
24
26
|
.to_s
|
|
25
27
|
.delete_suffix('Model')
|
|
26
28
|
.delete_suffix('Record')
|
|
27
|
-
.
|
|
29
|
+
.concat('Presenter')
|
|
28
30
|
end
|
|
29
31
|
|
|
30
|
-
def model_class
|
|
31
|
-
Presentable.classes
|
|
32
|
-
.select { self.for(_1) == self }
|
|
33
|
-
.optional do |classes|
|
|
34
|
-
next unless classes.many?
|
|
35
|
-
|
|
36
|
-
classes
|
|
37
|
-
.select { name_for(_1) == name }
|
|
38
|
-
.optional { classes if _1.empty? } # lookup failed — return original
|
|
39
|
-
end
|
|
40
|
-
.sole
|
|
41
|
-
rescue Enumerable::SoleItemExpectedError => error
|
|
42
|
-
raise Lookup::Error, "#{error.message
|
|
43
|
-
.sub('items', 'model classes')
|
|
44
|
-
.sub('item', 'model class')
|
|
45
|
-
} for #{self}"
|
|
46
|
-
end
|
|
32
|
+
def model_class = Presentable.for self
|
|
47
33
|
|
|
48
34
|
delegate_missing_to :model_class
|
|
49
35
|
|
|
50
|
-
|
|
51
|
-
Magic.eager_load :presenters
|
|
36
|
+
private
|
|
52
37
|
|
|
53
|
-
|
|
38
|
+
# Define collection presenter from the given block.
|
|
39
|
+
#
|
|
40
|
+
# class MyPresenter < Magic::Presenter::Base
|
|
41
|
+
# collection_presenter do
|
|
42
|
+
# def count = "#{super} items"
|
|
43
|
+
# end
|
|
44
|
+
# end
|
|
45
|
+
#
|
|
46
|
+
# class MyModel < ApplicationRecord
|
|
47
|
+
# end
|
|
48
|
+
#
|
|
49
|
+
# MyModel.all.count # => 42
|
|
50
|
+
# MyModel.all.decorated.count # => "42 items"
|
|
51
|
+
#
|
|
52
|
+
# It looks for a collection presenter class in ancestor classes
|
|
53
|
+
# to be inherited from, up to `Magic::Presenter::Collection`.
|
|
54
|
+
def collection_presenter(&)
|
|
55
|
+
if const_defined? :Collection, false
|
|
56
|
+
const_get :Collection
|
|
57
|
+
else
|
|
58
|
+
const_set :Collection, Class.new(const_get :Collection)
|
|
59
|
+
end.class_eval(&)
|
|
54
60
|
end
|
|
55
61
|
end
|
|
56
62
|
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Magic
|
|
4
|
+
module Presenter
|
|
5
|
+
# = Collection presenter
|
|
6
|
+
#
|
|
7
|
+
# This presenter is used as a base class to decorate typed
|
|
8
|
+
# collections (e.g., Active Record relations).
|
|
9
|
+
#
|
|
10
|
+
# == Presenter class inference
|
|
11
|
+
#
|
|
12
|
+
# Collection presenters provide automatic class inference for any
|
|
13
|
+
# typed collection based on the class name of its elements powered
|
|
14
|
+
# by Magic Lookup.
|
|
15
|
+
# For example, a collection of `MyRecord`s (e.g., `MyRecord.all`)
|
|
16
|
+
# looks for `MyPresenter::Collection` first.
|
|
17
|
+
# If not found, it looks for collection presenters of its ancestor
|
|
18
|
+
# classes, up to `ObjectPresenter::Collection`.
|
|
19
|
+
class Collection < EnumerableDecorator
|
|
20
|
+
prepend Helpers if defined? ::ActionView
|
|
21
|
+
|
|
22
|
+
class << self
|
|
23
|
+
def name_for(...) = Base.name_for(...)
|
|
24
|
+
.concat('::Collection')
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def item_presenter = model_class
|
|
28
|
+
&.then { Presenter.for it }
|
|
29
|
+
|
|
30
|
+
def model_class = __getobj__
|
|
31
|
+
.try :model_class
|
|
32
|
+
|
|
33
|
+
def to_a(...) = self.class.new super
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'magic/core_ext/kernel/optional'
|
|
4
|
-
|
|
5
3
|
module Magic
|
|
6
4
|
module Presenter
|
|
7
5
|
class Engine < ::Rails::Engine # :nodoc:
|
|
8
6
|
isolate_namespace Magic::Presenter
|
|
9
7
|
|
|
10
8
|
config.generators do
|
|
11
|
-
|
|
9
|
+
it.test_framework = :rspec
|
|
12
10
|
end
|
|
13
11
|
end
|
|
14
12
|
end
|
|
@@ -8,12 +8,10 @@ module Magic
|
|
|
8
8
|
# The Magic::Presenter::Helpers::MissingContext exception is
|
|
9
9
|
# raised when no view context to run helpers in has been set.
|
|
10
10
|
class MissingContext < RuntimeError
|
|
11
|
-
def message
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
TEXT
|
|
16
|
-
end
|
|
11
|
+
def message = <<~TEXT
|
|
12
|
+
missing view context
|
|
13
|
+
You should set Magic::Presenter.view_context first
|
|
14
|
+
TEXT
|
|
17
15
|
end
|
|
18
16
|
|
|
19
17
|
prepended do
|
|
@@ -46,7 +44,8 @@ module Magic
|
|
|
46
44
|
|
|
47
45
|
def respond_to_missing?(method, ...)
|
|
48
46
|
super or
|
|
49
|
-
(helpers if view_context)
|
|
47
|
+
(helpers if view_context)
|
|
48
|
+
&.respond_to?(method, ...) # rubocop:disable Lint/RedundantSafeNavigation
|
|
50
49
|
end
|
|
51
50
|
end
|
|
52
51
|
end
|
data/lib/magic/presenter.rb
CHANGED
|
@@ -8,11 +8,12 @@ require_relative 'presenter/engine'
|
|
|
8
8
|
module Magic # :nodoc:
|
|
9
9
|
# Presentation layer for Rails models
|
|
10
10
|
module Presenter
|
|
11
|
-
autoload :Base,
|
|
12
|
-
autoload :
|
|
13
|
-
autoload :
|
|
14
|
-
autoload :
|
|
15
|
-
autoload :
|
|
11
|
+
autoload :Base, 'magic/presenter/base'
|
|
12
|
+
autoload :Collection, 'magic/presenter/collection'
|
|
13
|
+
autoload :Helpers, 'magic/presenter/helpers'
|
|
14
|
+
autoload :GlobalID, 'magic/presenter/global_id'
|
|
15
|
+
autoload :TestCase, 'magic/presenter/test_case'
|
|
16
|
+
autoload :Generator, 'generators/magic/presenter/generator'
|
|
16
17
|
|
|
17
18
|
singleton_class.delegate *%i[
|
|
18
19
|
for name_for
|
|
@@ -22,20 +23,9 @@ module Magic # :nodoc:
|
|
|
22
23
|
|
|
23
24
|
module_function # TODO: extract to Magic Support
|
|
24
25
|
|
|
25
|
-
def eager_load *scopes, engine: Rails.application
|
|
26
|
-
return if Rails.application.config.eager_load
|
|
27
|
-
|
|
28
|
-
scopes
|
|
29
|
-
.map(&:to_s)
|
|
30
|
-
.map(&:pluralize)
|
|
31
|
-
.map { engine.root / 'app' / _1 }
|
|
32
|
-
.select(&:exist?)
|
|
33
|
-
.each { Rails.autoloaders.main.eager_load_dir _1 }
|
|
34
|
-
end
|
|
35
|
-
|
|
36
26
|
def each_engine(&)
|
|
37
27
|
Rails.application
|
|
38
|
-
.then { [
|
|
28
|
+
.then { [ it, *it.railties ] }
|
|
39
29
|
.grep(Rails::Engine)
|
|
40
30
|
.each(&)
|
|
41
31
|
end
|
metadata
CHANGED
|
@@ -1,135 +1,134 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: magic-presenter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
- Alexander Senko
|
|
7
|
+
- Alexander Senko
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
|
-
- !ruby/object:Gem::Dependency
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
70
|
-
requirements:
|
|
71
|
-
- - ">="
|
|
72
|
-
- !ruby/object:Gem::Version
|
|
73
|
-
version: '0'
|
|
74
|
-
description: Based on Magic Decorator, it’s meant to replace Draper.
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: rails
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
-
|
|
17
|
+
- ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: "7.2"
|
|
20
|
+
-
|
|
21
|
+
- "<"
|
|
22
|
+
- !ruby/object:Gem::Version
|
|
23
|
+
version: "9"
|
|
24
|
+
type: :runtime
|
|
25
|
+
prerelease: false
|
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
27
|
+
requirements:
|
|
28
|
+
-
|
|
29
|
+
- ">="
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: "7.2"
|
|
32
|
+
-
|
|
33
|
+
- "<"
|
|
34
|
+
- !ruby/object:Gem::Version
|
|
35
|
+
version: "9"
|
|
36
|
+
- !ruby/object:Gem::Dependency
|
|
37
|
+
name: magic-decorator
|
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
|
39
|
+
requirements:
|
|
40
|
+
-
|
|
41
|
+
- ~>
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: "1.2"
|
|
44
|
+
type: :runtime
|
|
45
|
+
prerelease: false
|
|
46
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
47
|
+
requirements:
|
|
48
|
+
-
|
|
49
|
+
- ~>
|
|
50
|
+
- !ruby/object:Gem::Version
|
|
51
|
+
version: "1.2"
|
|
52
|
+
- !ruby/object:Gem::Dependency
|
|
53
|
+
name: magic-lookup
|
|
54
|
+
requirement: !ruby/object:Gem::Requirement
|
|
55
|
+
requirements:
|
|
56
|
+
-
|
|
57
|
+
- ~>
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
version: "1.0"
|
|
60
|
+
type: :runtime
|
|
61
|
+
prerelease: false
|
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
63
|
+
requirements:
|
|
64
|
+
-
|
|
65
|
+
- ~>
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: "1.0"
|
|
68
|
+
description: "Based on Magic Decorator, it is meant to replace Draper."
|
|
75
69
|
email:
|
|
76
|
-
- Alexander.Senko@gmail.com
|
|
70
|
+
- Alexander.Senko@gmail.com
|
|
77
71
|
executables: []
|
|
78
72
|
extensions: []
|
|
79
73
|
extra_rdoc_files: []
|
|
80
74
|
files:
|
|
81
|
-
- MIT-LICENSE
|
|
82
|
-
- README.md
|
|
83
|
-
- Rakefile
|
|
84
|
-
- app/models/concerns/magic/presentable.rb
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
- config/initializers/
|
|
88
|
-
- config/initializers/
|
|
89
|
-
- config/initializers/
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
- lib/generators/magic/presenter/
|
|
93
|
-
- lib/generators/magic/presenter/install/
|
|
94
|
-
- lib/generators/
|
|
95
|
-
- lib/generators/
|
|
96
|
-
- lib/generators/rails/presenter/
|
|
97
|
-
- lib/generators/
|
|
98
|
-
- lib/generators/
|
|
99
|
-
- lib/generators/
|
|
100
|
-
- lib/generators/
|
|
101
|
-
- lib/
|
|
102
|
-
- lib/
|
|
103
|
-
- lib/magic/presenter
|
|
104
|
-
- lib/magic/presenter/
|
|
105
|
-
- lib/magic/presenter/
|
|
106
|
-
- lib/magic/presenter/
|
|
107
|
-
- lib/magic/presenter/
|
|
108
|
-
- lib/magic/presenter/
|
|
109
|
-
- lib/
|
|
110
|
-
- lib/
|
|
111
|
-
|
|
75
|
+
- MIT-LICENSE
|
|
76
|
+
- README.md
|
|
77
|
+
- Rakefile
|
|
78
|
+
- app/models/concerns/magic/presentable.rb
|
|
79
|
+
- app/models/concerns/magic/presentable/active_record_collection.rb
|
|
80
|
+
- app/models/concerns/magic/presentable/collection.rb
|
|
81
|
+
- config/initializers/action_controller.rb
|
|
82
|
+
- config/initializers/action_view.rb
|
|
83
|
+
- config/initializers/generators.rb
|
|
84
|
+
- config/initializers/presentable.rb
|
|
85
|
+
- config/initializers/rspec.rb
|
|
86
|
+
- lib/generators/magic/presenter/generator.rb
|
|
87
|
+
- lib/generators/magic/presenter/install/USAGE
|
|
88
|
+
- lib/generators/magic/presenter/install/install_generator.rb
|
|
89
|
+
- lib/generators/magic/presenter/install/templates/application_presenter.rb.tt
|
|
90
|
+
- lib/generators/rails/presenter/USAGE
|
|
91
|
+
- lib/generators/rails/presenter/presenter_generator.rb
|
|
92
|
+
- lib/generators/rails/presenter/templates/presenter.rb.tt
|
|
93
|
+
- lib/generators/rspec/presenter/presenter_generator.rb
|
|
94
|
+
- lib/generators/rspec/presenter/templates/presenter_spec.rb.tt
|
|
95
|
+
- lib/generators/test_unit/presenter/presenter_generator.rb
|
|
96
|
+
- lib/generators/test_unit/presenter/templates/presenter_test.rb.tt
|
|
97
|
+
- lib/magic/presenter.rb
|
|
98
|
+
- lib/magic/presenter/authors.rb
|
|
99
|
+
- lib/magic/presenter/base.rb
|
|
100
|
+
- lib/magic/presenter/collection.rb
|
|
101
|
+
- lib/magic/presenter/engine.rb
|
|
102
|
+
- lib/magic/presenter/global_id.rb
|
|
103
|
+
- lib/magic/presenter/helpers.rb
|
|
104
|
+
- lib/magic/presenter/test_case.rb
|
|
105
|
+
- lib/magic/presenter/version.rb
|
|
106
|
+
- lib/rspec/rails/example/presenter_example_group.rb
|
|
107
|
+
- lib/tasks/magic/presenter_tasks.rake
|
|
108
|
+
homepage: "https://github.com/Alexander-Senko/magic-presenter"
|
|
112
109
|
licenses:
|
|
113
|
-
- MIT
|
|
110
|
+
- MIT
|
|
114
111
|
metadata:
|
|
115
|
-
homepage_uri: https://github.com/Alexander-Senko/magic-presenter
|
|
116
|
-
source_code_uri: https://github.com/Alexander-Senko/magic-presenter
|
|
117
|
-
changelog_uri: https://github.com/Alexander-Senko/magic-presenter/blob/v1.
|
|
112
|
+
homepage_uri: "https://github.com/Alexander-Senko/magic-presenter"
|
|
113
|
+
source_code_uri: "https://github.com/Alexander-Senko/magic-presenter"
|
|
114
|
+
changelog_uri: "https://github.com/Alexander-Senko/magic-presenter/blob/v1.3.0/CHANGELOG.md"
|
|
118
115
|
rdoc_options: []
|
|
119
116
|
require_paths:
|
|
120
|
-
- lib
|
|
117
|
+
- lib
|
|
121
118
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
122
119
|
requirements:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
-
|
|
121
|
+
- ">="
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: "3.4"
|
|
126
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
125
|
requirements:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
-
|
|
127
|
+
- ">="
|
|
128
|
+
- !ruby/object:Gem::Version
|
|
129
|
+
version: "0"
|
|
131
130
|
requirements: []
|
|
132
|
-
rubygems_version:
|
|
131
|
+
rubygems_version: 4.1.0.dev
|
|
133
132
|
specification_version: 4
|
|
134
133
|
summary: Presentation layer for Rails models
|
|
135
134
|
test_files: []
|