Class: ANVL::Erc

Inherits:
Document show all
Defined in:
lib/anvl/erc.rb

Defined Under Namespace

Classes: Element

Constant Summary collapse

STORY_TO_OFFSET =
{ 'erc' => 0, 'about-erc' => 10, 'support-erc' => 20, 'meta-erc' => 30 }
LABEL_TO_SYN =
{ 
  'who' => 'h1', 'what' => 'h2', 'when' => 'h3', 'where' => 'h4', 'how' => 'h5',
  'about-who' => 'h11', 'about-what' => 'h12', 'about-when' => 'h13', 'about-where' => 'h14', 'about-how' => 'h15',
  'support-who' => 'h21', 'support-what' => 'h22', 'support-when' => 'h23', 'support-where' => 'h24',
  'meta-who' => 'h31', 'meta-what' => 'h32', 'meta-when' => 'h33', 'meta-where' => 'h34'
}
SYN_TO_KERNEL =
LABEL_TO_SYN.invert

Instance Attribute Summary

Attributes inherited from Document

#entries

Instance Method Summary collapse

Methods inherited from Document

#[], #initialize, parse, #push, #to_h, #to_s

Constructor Details

This class inherits a constructor from ANVL::Document

Instance Method Details

#[]=(display_label, value, append = false) ⇒ Object Also known as: store



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/anvl/erc.rb', line 73

def []= display_label, value, append = false
  if value[0,1] != '|' and STORY_TO_OFFSET[display_label] and !value.strip.empty?
    process_abbr_form display_label, value 
  elsif value[0,1] != ';' and value =~ /;/
    value.split(';').each do |v|
      self.store display_label, v, true
    end
  else
    super
  end
end

#complete?Boolean

Returns:

  • (Boolean)


86
87
88
89
90
91
# File 'lib/anvl/erc.rb', line 86

def complete?
  !(self.fetch(:h1).empty? or self.fetch(:h2).empty? or self.fetch(:h3).empty? or self.fetch(:h4).empty?) ||
  !(self.fetch(:h11).empty? or self.fetch(:h12).empty? or self.fetch(:h13).empty? or self.fetch(:h14).empty?)  ||
  !(self.fetch(:h21).empty? or self.fetch(:h22).empty? or self.fetch(:h23).empty? or self.fetch(:h24).empty?) ||
  !(self.fetch(:h31).empty? or self.fetch(:h32).empty? or self.fetch(:h33).empty? or self.fetch(:h34).empty?)
end