Module: SummaryJudgement::InstanceMethods
- Defined in:
- lib/summary_judgement/instance_methods.rb
Instance Method Summary collapse
- #adjectives ⇒ Object
- #canopy ⇒ Object
- #children ⇒ Object
- #modifiers ⇒ Object
- #summary(options = {}) ⇒ Object
- #term ⇒ Object
Instance Method Details
#adjectives ⇒ Object
17 18 19 |
# File 'lib/summary_judgement/instance_methods.rb', line 17 def adjectives self.class.summary.adjectives.select { |a| a.condition.nil? or self.class.summary.class.render(a.condition, self) }.map { |a| self.class.summary.class.render a.phrase, self} end |
#canopy ⇒ Object
31 32 33 34 |
# File 'lib/summary_judgement/instance_methods.rb', line 31 def canopy branches, leaves = children.flatten.partition(&:children) (leaves + branches.collect(&:canopy)).flatten.uniq end |
#children ⇒ Object
25 26 27 28 29 |
# File 'lib/summary_judgement/instance_methods.rb', line 25 def children subordinates = self.class.summary.class.render(self.class.summary.subordinates, self) subordinates.flatten! if subordinates.respond_to? :flatten! subordinates end |
#modifiers ⇒ Object
21 22 23 |
# File 'lib/summary_judgement/instance_methods.rb', line 21 def modifiers self.class.summary.modifiers.select { |m| m.condition.nil? or self.class.summary.class.render(m.condition, self) }.map { |m| self.class.summary.class.render m.phrase, self} end |
#summary(options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/summary_judgement/instance_methods.rb', line 3 def summary( = {}) if children and !canopy.empty? summarize_as_branch() elsif !self.class.summary.subordinates.empty? () elsif term summarize_as_leaf() end end |
#term ⇒ Object
13 14 15 |
# File 'lib/summary_judgement/instance_methods.rb', line 13 def term self.class.summary.class.render self.class.summary.terms.find { |t| t.condition.nil? or self.class.summary.class.render(t.condition, self) }.phrase, self end |