arch_presenter 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/arch_presenter/base.rb +13 -7
- data/lib/arch_presenter/presenter.rb +11 -0
- data/lib/arch_presenter/version.rb +1 -1
- data/lib/arch_presenter.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb794699ccb559435c81e52795a04acc0e5c4b61
|
4
|
+
data.tar.gz: 6453a3562330dbd0a261a47e0de3adc07599b591
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58b2012837dbfd274afa76ccad3dfd97fafccef27a336da2f1c57236ef50f52496ded250fb54bc47d37ee55f833b06d94eb51f65592fb0fd4558c867e30e9263
|
7
|
+
data.tar.gz: 600b112a3e28fcd23dbe7d2f20a4f8b134c52521e692cce4122715fff237220e00011afad2d1cfc0933de4e612fc795f765015d1d9af9f762d13df6c5ddd4f2a
|
data/.gitignore
CHANGED
data/lib/arch_presenter/base.rb
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
module ArchPresenter
|
2
|
-
class Base
|
3
|
-
def self.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
class Base < ::SimpleDelegator
|
3
|
+
def self.human_attribute_name(*args)
|
4
|
+
original_class.human_attribute_name(*args)
|
5
|
+
end
|
6
|
+
|
7
|
+
def original_class
|
8
|
+
presenter_class_name.chomp('Presenter').constantize
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def presenter_class_name
|
14
|
+
self.class.to_s
|
9
15
|
end
|
10
16
|
end
|
11
17
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module ArchPresenter
|
2
|
+
class Presenter
|
3
|
+
def self.present(target_object)
|
4
|
+
presenter_class_name = "#{target_object.class}Presenter"
|
5
|
+
class_constant = presenter_class_name.constantize
|
6
|
+
class_constant.new(target_object)
|
7
|
+
rescue NameError
|
8
|
+
target_object
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/arch_presenter.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arch_presenter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Przemyslaw Krowinski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,6 +58,7 @@ files:
|
|
58
58
|
- lib/arch_presenter/action_controller/methods.rb
|
59
59
|
- lib/arch_presenter/action_view/helpers.rb
|
60
60
|
- lib/arch_presenter/base.rb
|
61
|
+
- lib/arch_presenter/presenter.rb
|
61
62
|
- lib/arch_presenter/railtie.rb
|
62
63
|
- lib/arch_presenter/version.rb
|
63
64
|
homepage: https://github.com/archdragon/arch_presenter
|