Class: Rubyword::Element::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyword/element/base.rb

Direct Known Subclasses

Image, Link, List, PageBreak, Table, Text, TextBreak

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rubyword, section = nil) ⇒ Base

Returns a new instance of Base.



6
7
8
9
# File 'lib/rubyword/element/base.rb', line 6

def initialize(rubyword, section=nil)
  @rubyword = rubyword
  @section = section
end

Instance Attribute Details

#rubywordObject

Returns the value of attribute rubyword.



5
6
7
# File 'lib/rubyword/element/base.rb', line 5

def rubyword
  @rubyword
end

#sectionObject

Returns the value of attribute section.



5
6
7
# File 'lib/rubyword/element/base.rb', line 5

def section
  @section
end

Instance Method Details

#filter_text(text) ⇒ Object

filter html special char



12
13
14
15
16
17
18
19
20
# File 'lib/rubyword/element/base.rb', line 12

def filter_text(text)
  text = text.to_s
  text.gsub('&', '&')
  text.gsub('\'', ''')
  text.gsub('"', '"')
  text.gsub('<', '&lt;')
  text.gsub('>', '&gt;')
  text
end