draper 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/lib/draper/base.rb CHANGED
@@ -5,7 +5,7 @@ module Draper
5
5
  include ActionView::Helpers::TextHelper
6
6
 
7
7
  require 'active_support/core_ext/class/attribute'
8
- class_attribute :denied, :allowed
8
+ class_attribute :denied, :allowed, :source_class
9
9
  attr_accessor :source
10
10
 
11
11
  DEFAULT_DENIED = Object.new.methods << :method_missing
@@ -13,6 +13,7 @@ module Draper
13
13
 
14
14
  def initialize(subject)
15
15
  subject.inspect
16
+ self.source_class = subject.class
16
17
  self.source = subject
17
18
  build_methods
18
19
  end
@@ -36,6 +37,10 @@ module Draper
36
37
  def helpers
37
38
  ActionController::Base.helpers
38
39
  end
40
+
41
+ def self.model_name
42
+ ActiveModel::Name.new(source_class)
43
+ end
39
44
 
40
45
  private
41
46
  def select_methods
@@ -1,3 +1,3 @@
1
1
  module Draper
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: draper
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.4
5
+ version: 0.3.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jeff Casimir
@@ -143,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
143
143
  requirements:
144
144
  - - ">="
145
145
  - !ruby/object:Gem::Version
146
- hash: 941062557959247963
146
+ hash: -2342952529279476133
147
147
  segments:
148
148
  - 0
149
149
  version: "0"
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  requirements:
153
153
  - - ">="
154
154
  - !ruby/object:Gem::Version
155
- hash: 941062557959247963
155
+ hash: -2342952529279476133
156
156
  segments:
157
157
  - 0
158
158
  version: "0"