In Files
Parent
- Component
Class Index
- WebRI
- WebRI::Blackfish
- WebRI::Component
- WebRI::Generator
- WebRI::GeneratorOne
- WebRI::GitHub
- WebRI::Heirarchy
- WebRI::Highlight
- WebRI::Icons
- WebRI::JSONFile
- WebRI::Longfish
- WebRI::Metadata
- WebRI::Newfish
- WebRI::Oldfish
- WebRI::Onefish
- WebRI::Prettify
- WebRI::Redfish
- WebRI::RiService
- WebRI::Search
- WebRI::Search::FilesTree
- WebRI::Server
- WebRI::Subversion
- WebRI::Template
- WebRI::TimeDelta
- WebRI::Twofish
- RDoc
- RDoc::AnyMethod
- RDoc::ClassModule
- RDoc::Options
- RDoc::Parser
- RDoc::Parser::C
- RDoc::TopLevel
- Syckle
- Syckle::Plugins
- Syckle::Plugins::WebRI
- Object
- OpEsc
JSONFile
TODO: This component is not finished. The actual json produced needs to be fleshed out more, making sure we have all the data we want in there, and theat it is layedout in the optimal structure.
TODO: RDoc has some json related stuff going on. I found RDoc::TopLevel.json_creatable?, so maybe there’s a much better wat to do this component.
Public Instance Methods
all_methods()
click to toggle source
All methods.
# File lib/webri/components/jsonfile.rb, line 166 def all_methods @methods ||= ( list = [] classes.map do |mod| mod.method_list.each do |method| list << method end end list ) end
class_tree()
click to toggle source
Build class/module namespace tree structure.
# File lib/webri/components/jsonfile.rb, line 42 def class_tree @class_tree ||= generate_class_tree end
classes()
click to toggle source
— CLASS/MODULES —————————————————-
# File lib/webri/components/jsonfile.rb, line 37 def classes generator.all_classes_and_modules end
file_tree()
click to toggle source
(Not documented)
# File lib/webri/components/jsonfile.rb, line 89 def file_tree @file_tree ||= generate_file_tree end
files()
click to toggle source
— FILES ——————————————————
# File lib/webri/components/jsonfile.rb, line 85 def files generator.files end
generate()
click to toggle source
Save as json.
# File lib/webri/components/jsonfile.rb, line 17 def generate puts RDoc::TopLevel.json_creatable? puts RDoc::TopLevel.to_json save_data(class_tree, 'classes.json') save_data(file_tree , 'files.json') save_data(methods , 'methods.json') end
generate_class_tree()
click to toggle source
(Not documented)
# File lib/webri/components/jsonfile.rb, line 46 def generate_class_tree debug_msg "Generating class tree:" topclasses = classes.select {|klass| !(RDoc::ClassModule === klass.parent) } generate_class_tree_level(topclasses) end
generate_class_tree_level(classes)
click to toggle source
Recursivly build class/module namespace tree structure
# File lib/webri/components/jsonfile.rb, line 53 def generate_class_tree_level(classes) tree = [] list = classes.select{|c| c.with_documentation? } list = list.sort list.each do |c| item = c.to_h item[:methods] = c.method_list.map{ |m| m.to_h } item[:classes] = generate_class_tree_level(c.classes_and_modules) tree << item end tree end
generate_file_tree()
click to toggle source
# File lib/webri/components/jsonfile.rb, line 94 def generate_file_tree debug_msg "Generating file tree:" return {} if files.empty? ftree = {} files.each do |file| path = file.full_name generate_file_tree_level(path, file, ftree) end ftree end
generate_file_tree_level(path, file, tree)
click to toggle source
(Not documented)
# File lib/webri/components/jsonfile.rb, line 105 def generate_file_tree_level(path, file, tree) parent, *subpath = *path.split(File::SEPARATOR) subpath = subpath.join(File::SEPARATOR) tree[parent] ||= {} e = tree[parent] e[:name] = parent if subpath.empty? e.merge!(file.to_h) else e[:files] ||= {} generate_file_tree_level(subpath, file, e[:files]) end end
Disabled; run with --debug to generate this.