Class: Oxcelix::Comments

Inherits:
Ox::Sax
  • Object
show all
Defined in:
lib/oxcelix/sax/comments.rb

Overview

The Comments class is a parser which builds an array of comments

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeComments


9
10
11
12
# File 'lib/oxcelix/sax/comments.rb', line 9

def initialize
  @commarray = []
  @comment   = {}
end

Instance Attribute Details

#commarrayArray


8
9
10
# File 'lib/oxcelix/sax/comments.rb', line 8

def commarray
  @commarray
end

#commentHash


8
# File 'lib/oxcelix/sax/comments.rb', line 8

attr_accessor :commarray, :comment

Instance Method Details

#attr(name, str) ⇒ Object

Returns reference


22
23
24
25
26
# File 'lib/oxcelix/sax/comments.rb', line 22

def attr(name, str)
  if name == :ref
    @comment[:ref] = str
  end
end

#text(str) ⇒ Object

Push Cell comment hash (comment + reference) to @commarray


15
16
17
18
19
# File 'lib/oxcelix/sax/comments.rb', line 15

def text(str)
  @comment[:comment] = str.gsub('
', '')
  @commarray << @comment
  @comment = Hash.new
end