Sha256: 9cb5bc1d0ca289b065c294b50fdbf00e5f15f2e2a2cc13473f4776d9b9e9dc13

Contents?: true

Size: 1.67 KB

Versions: 1

Compression:

Stored size: 1.67 KB

Contents

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>range? (XMLProver::Proofreader)</title>
<link rel=StyleSheet href="../../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body bgcolor="white">
<pre><span class="cmt"># File proofreader.rb, line 212</span>
    <span class="kw">def</span> range?(eloras, die)
      validity = <span class="kw">true</span>  <span class="cmt"># default range, 0..*</span>
      <span class="kw">if</span> die
        <span class="kw">if</span> die.range
          <span class="cmt"># divide and count eloras by parent groups</span>
          parent_groups = Hash.new(0)
          eloras.each <span class="kw">do</span> |elora|
            <span class="kw">case</span> elora
            <span class="kw">when</span> REXML::Attribute
              parent_groups[elora.element] += 1
            <span class="kw">when</span> REXML::Element
              parent_groups[elora.parent] += 1
            <span class="kw">end</span>
          <span class="kw">end</span>
          parent_groups.each <span class="kw">do</span> |parent, tally|
            <span class="kw">if</span> <span class="kw">not</span> die.range === tally
              validity = <span class="kw">false</span>
              error = &quot;RANGE #{tally} ##{die.range}#&quot;
              @errors &lt;&lt; [die.namespace, die.xpath, error]
            <span class="kw">end</span>
          <span class="kw">end</span>
        <span class="kw">end</span>
      <span class="kw">end</span>
      <span class="kw">return</span> validity
    <span class="kw">end</span></pre>
</body>
</html>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mega-0.3.1 pub/xml/xmlproof/rdoc/classes/XMLProver/Proofreader.src/M000033.html