Made .model public
This commit is contained in:
parent
fe84623edf
commit
cadac79498
|
@ -2,6 +2,7 @@ module Draper
|
|||
class Base
|
||||
require 'active_support/core_ext/class/attribute'
|
||||
class_attribute :denied, :allowed, :source_class
|
||||
attr_accessor :model
|
||||
|
||||
DEFAULT_DENIED = Object.new.methods
|
||||
self.denied = DEFAULT_DENIED
|
||||
|
@ -43,10 +44,6 @@ module Draper
|
|||
end
|
||||
|
||||
private
|
||||
def model
|
||||
@model
|
||||
end
|
||||
|
||||
def select_methods
|
||||
self.allowed || (model.public_methods - denied)
|
||||
end
|
||||
|
|
|
@ -9,6 +9,10 @@ describe Draper::Base do
|
|||
subject.to_model.should == source
|
||||
end
|
||||
|
||||
it "should return the wrapped object when asked for model" do
|
||||
subject.model.should == source
|
||||
end
|
||||
|
||||
it "should wrap source methods so they still accept blocks" do
|
||||
subject.gsub("Sample"){|match| "Super"}.should == "Super String"
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue