Class: FormatTagTable

Inherits:
Gtk::TextTagTable
  • Object
show all
Defined in:
lib/ManqodHelp/HelpBrowser/FormatTagTable.rb

Overview

this file is part of manqod manqod is distributed under the CDDL licence the author of manqod is Dobai-Pataky Balint([email protected])

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(browser) ⇒ FormatTagTable

Returns a new instance of FormatTagTable.



6
7
8
9
# File 'lib/ManqodHelp/HelpBrowser/FormatTagTable.rb', line 6

def initialize(browser)
	@browser=browser
	super()
end

Instance Attribute Details

#browserObject (readonly)

Returns the value of attribute browser.



10
11
12
# File 'lib/ManqodHelp/HelpBrowser/FormatTagTable.rb', line 10

def browser
  @browser
end

Instance Method Details

#add(arg) ⇒ Object



12
13
14
15
16
# File 'lib/ManqodHelp/HelpBrowser/FormatTagTable.rb', line 12

def add(arg)
	tag=FormatTag.new(self,arg)
	super(tag) if tag.name
	tag
end

#clearObject



33
34
35
36
37
# File 'lib/ManqodHelp/HelpBrowser/FormatTagTable.rb', line 33

def clear
	a=Array.new
	each{|tag| a.push(tag)}
	a.each{|tag| remove(tag)}
end

#lookup(name) ⇒ Object



30
31
32
# File 'lib/ManqodHelp/HelpBrowser/FormatTagTable.rb', line 30

def lookup(name)
	name.nil? ? nil : super(name)
end

#lookup_by_code(str) ⇒ Object



25
26
27
28
29
# File 'lib/ManqodHelp/HelpBrowser/FormatTagTable.rb', line 25

def lookup_by_code(str)
	found=nil
	each{|tag| found=tag if tag.code == Regexp.escape(str)}
	found
end

#markup_regexpObject



18
19
20
21
22
23
# File 'lib/ManqodHelp/HelpBrowser/FormatTagTable.rb', line 18

def markup_regexp
	r=""
	each{|tag| r=r+tag.code+"|" if tag.code && tag.code.length>1}
	r[r.length-1]="" if r.length>0 #remove the last |
	Regexp.compile(r)
end