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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb118fc0e2d1eb8387ac91890496af7037632f04
4
- data.tar.gz: ca38edfe95a3186a806d3458137d733a14d3525a
3
+ metadata.gz: cb794699ccb559435c81e52795a04acc0e5c4b61
4
+ data.tar.gz: 6453a3562330dbd0a261a47e0de3adc07599b591
5
5
  SHA512:
6
- metadata.gz: 84f844a9b3070212fc2b81e28aa3e64b1f4c54381617554f4c62983495633af2916b4d994e5f55e9951b91450815c51c8ac8620ea9499db7f3a3418543759da3
7
- data.tar.gz: 3ef774cb06f771759f0cda568e6efd74e3f7a8f6b7d1c801e5ec4401539b94458b3f0c2d89613200c0343560498c45e99a05c7e3bbb057fba1c8bac425ed39a7
6
+ metadata.gz: 58b2012837dbfd274afa76ccad3dfd97fafccef27a336da2f1c57236ef50f52496ded250fb54bc47d37ee55f833b06d94eb51f65592fb0fd4558c867e30e9263
7
+ data.tar.gz: 600b112a3e28fcd23dbe7d2f20a4f8b134c52521e692cce4122715fff237220e00011afad2d1cfc0933de4e612fc795f765015d1d9af9f762d13df6c5ddd4f2a
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
@@ -1,11 +1,17 @@
1
1
  module ArchPresenter
2
- class Base
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
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
@@ -1,3 +1,3 @@
1
1
  module ArchPresenter
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -1,5 +1,6 @@
1
1
  require 'arch_presenter/version'
2
2
  require 'arch_presenter/base'
3
+ require 'arch_presenter/presenter'
3
4
  require 'arch_presenter/action_view/helpers'
4
5
  require 'arch_presenter/action_controller/methods'
5
6
  require 'arch_presenter/railtie' if defined?(Rails)
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.3
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-14 00:00:00.000000000 Z
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