Module: SummaryJudgement::InstanceMethods

Defined in:
lib/summary_judgement/instance_methods.rb

Instance Method Summary collapse

Instance Method Details

#adjectivesObject



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

#canopyObject



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

#childrenObject



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

#modifiersObject



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(options = {})
  if children and !canopy.empty?
    summarize_as_branch(options)
  elsif !self.class.summary.subordinates.empty?
    summarize_as_bare_branch(options)
  elsif term
    summarize_as_leaf(options)
  end
end

#termObject



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