summary_judgement 1.3.6 → 1.3.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/summary_judgement/instance_methods.rb +20 -4
- data/summary_judgement.gemspec +1 -1
- data/test/helper.rb +6 -0
- data/test/test_summary_judgement.rb +6 -0
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.7
|
@@ -95,11 +95,27 @@ module SummaryJudgement
|
|
95
95
|
when TrueClass
|
96
96
|
options[:person] ||= :third
|
97
97
|
end
|
98
|
-
result << Verbs::Conjugator.conjugate(self.class.summary.predicate, options.slice(:person, :subject, :tense, :plurality)).to_s
|
99
|
-
results = result.humanize unless options[:subject].is_a?(String)
|
100
|
-
result << ' '
|
101
98
|
end
|
102
|
-
|
99
|
+
if placeholder = self.class.summary.default
|
100
|
+
if conjugation
|
101
|
+
result << Verbs::Conjugator.conjugate(self.class.summary.predicate, options.slice(:person, :subject, :tense, :plurality)).to_s
|
102
|
+
results = result.humanize unless options[:subject].is_a?(String)
|
103
|
+
result << ' '
|
104
|
+
end
|
105
|
+
result << self.class.summary.class.render(placeholder, self).with_indefinite_article(!conjugation)
|
106
|
+
elsif twigs = children.flatten.select(&:children)
|
107
|
+
if conjugation and options[:subject]
|
108
|
+
result << case options[:subject]
|
109
|
+
when String
|
110
|
+
options[:subject]
|
111
|
+
when Symbol, TrueClass
|
112
|
+
Verbs::Conjugator.subject(options.slice(:person, :plurality)).humanize
|
113
|
+
end
|
114
|
+
result << ' '
|
115
|
+
end
|
116
|
+
result << twigs.map { |t| t.summary options.merge(:subject => false, :conjugate => conjugation) }.to_sentence
|
117
|
+
end
|
118
|
+
result
|
103
119
|
end
|
104
120
|
|
105
121
|
def organize_leaves(*leaves)
|
data/summary_judgement.gemspec
CHANGED
data/test/helper.rb
CHANGED
@@ -13,6 +13,8 @@ class TestSummaryJudgement < Test::Unit::TestCase
|
|
13
13
|
@anne = Librarian.new
|
14
14
|
@seamus = Enthusiast.new
|
15
15
|
@new_releases = Shelf.new # empty!
|
16
|
+
@new_magazines = Rack.new # empty!
|
17
|
+
@browsing_section = Catalog.new @new_releases, @new_magazines
|
16
18
|
end
|
17
19
|
|
18
20
|
def test_setup
|
@@ -96,4 +98,8 @@ class TestSummaryJudgement < Test::Unit::TestCase
|
|
96
98
|
assert_equal 'I have read 2 books and have skimmed 1 magazine', @catalog.summary(:conjugate => :first, :subject => true, :aspect => :perfect)
|
97
99
|
assert_equal 'I have read a novel by William Gibson and an illustrated childrens book by Maurice Sendak and have skimmed a magazine issue from December 2009', @catalog.summary(:conjugate => :first, :subject => true, :aspect => :perfect, :verbose => true)
|
98
100
|
end
|
101
|
+
|
102
|
+
def test_delegated_placeholders
|
103
|
+
assert_equal 'You have an empty shelf and have an empty rack', @browsing_section.summary(:conjugate => :second, :subject => true)
|
104
|
+
end
|
99
105
|
end
|