poser 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,18 +22,12 @@ module Poser
22
22
 
23
23
  attr_reader :context
24
24
 
25
- alias_method :__class__, :class
26
-
27
25
  def id
28
26
  __getobj__.id
29
27
  end
30
28
 
31
- def class
32
- __getobj__.class
33
- end
34
-
35
29
  def present(object)
36
- __class__.present object, context
30
+ self.class.present object, context
37
31
  end
38
32
 
39
33
  def presented?
@@ -41,7 +35,7 @@ module Poser
41
35
  end
42
36
 
43
37
  def ==(other)
44
- other.is_a?(__class__) && context == other.context && __getobj__ == other.__getobj__
38
+ other.is_a?(self.class) && context == other.context && __getobj__ == other.__getobj__
45
39
  end
46
40
 
47
41
  end
@@ -21,7 +21,11 @@ module Poser
21
21
  names.shift if names.empty? || names.first.empty?
22
22
 
23
23
  names.inject(Object) do |constant, name|
24
- constant.const_get name, false
24
+ if RUBY_VERSION =~ /^1\.8/
25
+ constant.const_get name
26
+ else
27
+ constant.const_get name, false
28
+ end
25
29
  end
26
30
  end
27
31
  end
@@ -1,3 +1,3 @@
1
1
  module Poser
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe Poser::EnumerablePresenter do
4
+ subject { described_class.new @presentee, @context }
5
+
6
+ before do
7
+ @presentee = mock Object
8
+ @context = mock Object
9
+ end
10
+
11
+ it { should be_a(Poser::Presenter) }
12
+
13
+ describe "each" do
14
+ it "yields each object presented" do
15
+ @presentee = [Object.new, Object.new]
16
+
17
+ yielded_objects = []
18
+ subject.each do |obj|
19
+ yielded_objects << obj
20
+ end
21
+
22
+ yielded_objects.should == [
23
+ subject.present(@presentee[0]),
24
+ subject.present(@presentee[1])
25
+ ]
26
+ end
27
+ end
28
+
29
+ end
@@ -68,12 +68,5 @@ describe Poser::Presenter do
68
68
  subject.present(object).should == result
69
69
  end
70
70
  end
71
-
72
- describe "class" do
73
- it "delegates to the presenter" do
74
- @presentee.stub(:class) { String }
75
- subject.class.should == String
76
- end
77
- end
78
71
  end
79
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -48,6 +48,7 @@ files:
48
48
  - lib/poser/version.rb
49
49
  - poser.gemspec
50
50
  - spec/poser/context_spec.rb
51
+ - spec/poser/enumerable_presenter_spec.rb
51
52
  - spec/poser/presentable_spec.rb
52
53
  - spec/poser/presenter_spec.rb
53
54
  - spec/poser_spec.rb
@@ -78,6 +79,7 @@ specification_version: 3
78
79
  summary: A minimal implementation of the presenter pattern.
79
80
  test_files:
80
81
  - spec/poser/context_spec.rb
82
+ - spec/poser/enumerable_presenter_spec.rb
81
83
  - spec/poser/presentable_spec.rb
82
84
  - spec/poser/presenter_spec.rb
83
85
  - spec/poser_spec.rb