Permalink
Browse files

work better with actionpack

  • Loading branch information...
Austin Schneider
Austin Schneider committed Apr 10, 2012
1 parent e274b53 commit 9226dc5e5fe251248b1e62193baaa7e48bc82ae7
Showing with 20 additions and 3 deletions.
  1. +12 −2 lib/poser/presenter.rb
  2. +1 −1 lib/poser/version.rb
  3. +7 −0 spec/poser/presenter_spec.rb
View
@@ -22,16 +22,26 @@ def initialize(presentee, context)
attr_reader :context
+ alias_method :__class__, :class
+
+ def id
+ __getobj__.id
+ end
+
+ def class
+ __getobj__.class
+ end
+
def present(object)
- self.class.present object, context
+ __class__.present object, context
end
def presented?
true
end
def ==(other)
- other.is_a?(self.class) && context == other.context && __getobj__ == other.__getobj__
+ other.is_a?(__class__) && context == other.context && __getobj__ == other.__getobj__
end
end
View
@@ -1,3 +1,3 @@
module Poser
- VERSION = "1.0.2"
+ VERSION = "1.0.3"
end
@@ -68,5 +68,12 @@
subject.present(object).should == result
end
end
+
+ describe "class" do
+ it "delegates to the presenter" do
+ @presentee.stub(:class) { String }
+ subject.class.should == String
+ end
+ end
end
end

0 comments on commit 9226dc5

Please sign in to comment.