Module: DataExtras

Included in:
Doc, Meth, RubyDoc::CLI::UI
Defined in:
lib/ruby_doc/data/data_extras.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



4
5
6
# File 'lib/ruby_doc/data/data_extras.rb', line 4

def self.extended(base) 
  base.class_variable_set(:@@all, [])
end

.lastObject

Page Last=============================


81
82
83
84
85
86
87
88
# File 'lib/ruby_doc/data/data_extras.rb', line 81

def self.last
  uie.sepL#
  list(Doc.all[2000..Doc.all.length])
  puts uie.sepR#
  
  uie.viewMenu#
  uie.browseControl("Last", Doc.all[2000..Doc.all.length])#
end

.list(page) ⇒ Object



26
27
28
# File 'lib/ruby_doc/data/data_extras.rb', line 26

def self.list(page) 
  page.each_with_index{|doc, index| uie.outputD(doc, index)}
end

.nextPage(currentPg) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ruby_doc/data/data_extras.rb', line 32

def self.nextPage(currentPg)
  case currentPg
  when "Page1" 
    page2
  when "Page2" 
    page3
  when "Page3" 
    page4
  when "Page4" 
    last
  end
end

.page2Object

Page 2===============================


54
55
56
57
58
59
60
61
# File 'lib/ruby_doc/data/data_extras.rb', line 54

def self.page2
  uie.sepL#
  list(Doc.all[500..999])
  puts uie.sepR#
  
  uie.browseMenu#
  uie.browseControl("Page2", Doc.all[500..999])#
end

.page3Object

Page 3===============================


63
64
65
66
67
68
69
70
# File 'lib/ruby_doc/data/data_extras.rb', line 63

def self.page3
  uie.sepL#
  list(Doc.all[1000..1499])
  puts uie.sepR#
  
  uie.browseMenu#
  uie.browseControl("Page3", Doc.all[1000..1499])#
end

.page4Object

Page 4===============================


72
73
74
75
76
77
78
79
# File 'lib/ruby_doc/data/data_extras.rb', line 72

def self.page4
  uie.sepL#
  list(Doc.all[1500..1999])
  puts uie.sepR#
  
  uie.browseMenu#
  uie.browseControl("Page4", Doc.all[1500..1999])#
end

.uieObject

UIExtras Shuttles



13
14
15
# File 'lib/ruby_doc/data/data_extras.rb', line 13

def self.uie 
  RubyDoc::CLI::UI
end

Instance Method Details

#allObject



8
9
10
# File 'lib/ruby_doc/data/data_extras.rb', line 8

def all 
  self.class_variable_get(:@@all)
end

#display(doc) ⇒ Object

Display Doc============================


90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/ruby_doc/data/data_extras.rb', line 90

def display(doc)
  Scraper.loadDocPage(doc)#Load
  
  uie.sepL#
  puts "Title: ".cyan + doc.name.upcase
  puts "Type: ".cyan + doc.type.upcase
  puts "\nDescription:".cyan
  description = doc.description
  puts uie.wrapped(description, 55)
  puts "\nMethods: ".cyan + "#{doc.methods.count}".yellow
  puts "Source: #{doc.url}".red 
  puts uie.sepR#
  
  uie.docMenu(doc)#
  uie.docControl(doc)#
end

#displayMeth(byName) ⇒ Object

Display Meth============================


118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/ruby_doc/data/data_extras.rb', line 118

def displayMeth(byName)
  meth = Meth.find(byName)
  Scraper.loadMethPage(meth)#Load
  
  uie.sepL#
  puts "Title: ".cyan + meth.name.upcase
  puts "Type: ".cyan + meth.type.upcase
  puts "\nDescription:".cyan
  description = meth.description
  puts uie.wrapped(description, 55)
  puts "\nSource: #{meth.url}".red
  puts uie.sepR#
  
  uie.methMenu#
  uie.methControl#
  
  RubyDoc::CLI.start if iN == "m"
end

#list(page) ⇒ Object

PageLister



22
23
24
# File 'lib/ruby_doc/data/data_extras.rb', line 22

def list(page) 
  page.each_with_index{|doc, index| uie.outputD(doc, index)}
end

#listMeths(doc) ⇒ Object

List Meths=============================


107
108
109
110
111
112
113
114
115
116
# File 'lib/ruby_doc/data/data_extras.rb', line 107

def listMeths(doc)
  uie.sepL#
  doc.methods.each_with_index do |meth, index|  
    puts "#{index + 1}. ".yellow + meth.cyan
  end 
  puts uie.sepR#
  
  uie.viewMenu#
  uie.methListControl(doc)#
end

#paginateALLObject

Page 1===============================


45
46
47
48
49
50
51
52
# File 'lib/ruby_doc/data/data_extras.rb', line 45

def paginateALL 
  uie.sepL#
  list(Doc.all[0..499])
  puts uie.sepR#
  
  uie.browseMenu#
  uie.browseControl("Page1", Doc.all[0..499])#
end

#superSEARCH(name) ⇒ Object

SUPER SEARCH============================


137
138
139
140
141
142
143
144
145
146
# File 'lib/ruby_doc/data/data_extras.rb', line 137

def superSEARCH(name)
  uie.sepL#
  matches = Doc.all.find_all{|doc| doc.name.downcase.include?(name)}
  
  uie.searchControl(matches)#
  puts uie.sepR#
  
  uie.viewMenu#
  uie.choiceControl(matches)#
end

#uieObject



17
18
19
# File 'lib/ruby_doc/data/data_extras.rb', line 17

def uie 
  RubyDoc::CLI::UI
end