Made .model public

This commit is contained in:
Jeff Casimir 2011-07-23 07:48:14 -07:00
parent fe84623edf
commit cadac79498
2 changed files with 6 additions and 5 deletions

View File

@ -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
@ -42,11 +43,7 @@ module Draper
@model
end
private
def model
@model
end
private
def select_methods
self.allowed || (model.public_methods - denied)
end

View File

@ -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