summary_judgement 1.3.4 → 1.3.6
Sign up to get free protection for your applications and to get access to all the features.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.6
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class String
|
2
2
|
def indefinite_article
|
3
|
-
if WORDS_WITH_INITIAL_VOWELS_THAT_ACT_LIKE_WORDS_WITH_INITIAL_CONSONANTS.include? first_word.first_term
|
3
|
+
if WORDS_WITH_INITIAL_VOWELS_THAT_ACT_LIKE_WORDS_WITH_INITIAL_CONSONANTS.include? first_word.first_term.downcase
|
4
4
|
INDEFINITE_ARTICLES[:consonant]
|
5
5
|
elsif VOWELS.include? first.downcase
|
6
6
|
INDEFINITE_ARTICLES[:vowel]
|
@@ -25,7 +25,7 @@ class String
|
|
25
25
|
split('-').first
|
26
26
|
end
|
27
27
|
|
28
|
-
WORDS_WITH_INITIAL_VOWELS_THAT_ACT_LIKE_WORDS_WITH_INITIAL_CONSONANTS = %w(one)
|
28
|
+
WORDS_WITH_INITIAL_VOWELS_THAT_ACT_LIKE_WORDS_WITH_INITIAL_CONSONANTS = %w(one united)
|
29
29
|
INDEFINITE_ARTICLES = { :vowel => 'an', :consonant => 'a'}
|
30
30
|
VOWELS = %w(a e i o u)
|
31
31
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module SummaryJudgement
|
2
2
|
module InstanceMethods
|
3
3
|
def summary(options = {})
|
4
|
-
if children and !
|
4
|
+
if children and !canopy.empty?
|
5
5
|
summarize_as_branch(options)
|
6
6
|
elsif !self.class.summary.subordinates.empty?
|
7
7
|
summarize_as_bare_branch(options)
|
@@ -77,9 +77,9 @@ module SummaryJudgement
|
|
77
77
|
verbosity = canopy.length <= verbosity if verbosity.is_a? Fixnum
|
78
78
|
|
79
79
|
tufts = organize_leaves(*leaves)
|
80
|
+
connector = (verbosity and tufts.values.any? {|t| t.length > 2}) ? ';' : ','
|
80
81
|
first_tuft = tufts.shift
|
81
|
-
|
82
|
-
result << tufts.map { |tuft| summarize_tuft(tuft, conjugation, verbosity, options) }.unshift(summarize_tuft(first_tuft, conjugation, verbosity, options.merge(:capitalize_anonymous => true))).to_sentence(:words_connector => "#{connector} ", :last_word_connector => "#{connector} and")
|
82
|
+
result << tufts.map { |tuft| summarize_tuft(tuft, conjugation, verbosity, options) }.unshift(summarize_tuft(first_tuft, conjugation, verbosity, options.merge(:capitalize_anonymous => true))).to_sentence(:words_connector => "#{connector} ", :last_word_connector => "#{connector} and ")
|
83
83
|
end
|
84
84
|
|
85
85
|
def summarize_as_bare_branch(options = {})
|
@@ -95,10 +95,11 @@ 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
|
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)
|
99
100
|
result << ' '
|
100
101
|
end
|
101
|
-
result << self.class.summary.class.render(self.class.summary.default, self).with_indefinite_article
|
102
|
+
result << self.class.summary.class.render(self.class.summary.default, self).with_indefinite_article(!conjugation)
|
102
103
|
end
|
103
104
|
|
104
105
|
def organize_leaves(*leaves)
|
@@ -118,7 +119,7 @@ module SummaryJudgement
|
|
118
119
|
tuft_summary << ' '
|
119
120
|
end
|
120
121
|
if verbosity
|
121
|
-
if conjugation
|
122
|
+
if conjugation or !options[:capitalize_anonymous]
|
122
123
|
tuft_summary << siblings.map { |leaf| leaf.summary :capitalize_indefinite_article => false }.to_sentence
|
123
124
|
else
|
124
125
|
first_sibling = siblings.shift
|
data/summary_judgement.gemspec
CHANGED