class ClassDocuShower
#¶ ↑
Colour-related code will be stored here.
#¶ ↑
#¶ ↑
require 'class_docu_shower/version/version.rb'
#¶ ↑
Constants
- DEFAULT_FILE
#¶ ↑
DEFAULT_FILE
¶ ↑#¶ ↑
- ENCODING_TO_USE
#¶ ↑
ENCODING_TO_USE
¶ ↑#¶ ↑
- FORBIDDEN_CHARACTERS
#¶ ↑
FORBIDDEN_CHARACTERS
¶ ↑#¶ ↑
- N
- VERSION
#¶ ↑
ClassDocuShower::VERSION
¶ ↑#¶ ↑
Public Class Methods
[](i)
click to toggle source
new( i = nil, run_already = true ) { || ... }
click to toggle source
#¶ ↑
initialize¶ ↑
The first argument should be a .rb file.
The second argument can be :silent, in which case we will be silent rather than verbose.
#¶ ↑
# File lib/class_docu_shower/class_docu_shower.rb, line 56 def initialize( i = nil, run_already = true ) be_silent reset set_files(i) if run_already.is_a? Hash # Intercept hash here. if run_already.has_key? :verbose @be_verbose = run_already[:verbose] run_already = true end else case run_already when :silent be_silent run_already = true when :no_colours @use_colours = false run_already = true end end if block_given? yielded = yield case yielded when :do_not_report_the_filename @report_the_filename = false end end run if run_already end
Public Instance Methods
be_silent()
click to toggle source
be_verbose()
click to toggle source
file?()
click to toggle source
files?()
click to toggle source
#¶ ↑
files?¶ ↑
#¶ ↑
# File lib/class_docu_shower/class_docu_shower.rb, line 191 def files? @files end
Also aliased as: files
lightblue(i)
click to toggle source
orange(i)
click to toggle source
process()
click to toggle source
process_dataset()
click to toggle source
#¶ ↑
process_dataset
¶ ↑
#¶ ↑
# File lib/class_docu_shower/class_docu_shower.rb, line 221 def process_dataset reset_usher_object if @data @data.each {|entry| # @data is an Array. if entry.include? FORBIDDEN_CHARACTERS # Reject leading '# ===' parts. @usher.toggle if @usher else # ================================================================= # # Else add the entry. We should not use .lstrip on it because # that way we can preserve the original indent. # ================================================================= # entry.delete!('#') # .lstrip if use_colours? and Object.const_defined?(:Colours) if entry.start_with? ' ===' entry = orange(entry) elsif entry.include? 'Usage examples:' entry = lightblue(entry) end end @usher << entry if @usher end } @result = @usher._ if @usher end end
read_in_file(this_file = @file)
click to toggle source
#¶ ↑
read_in_file
¶ ↑
We determine @data here.
#¶ ↑
# File lib/class_docu_shower/class_docu_shower.rb, line 153 def read_in_file(this_file = @file) if File.exist? this_file @data = File.readlines(this_file, :encoding => ENCODING_TO_USE) else # We should report. result = 'We could not find a file at '+sfile(this_file)+',' result = Colours.remove_colours(result) unless use_colours? opn; e result result = 'thus can not check whether it has an documentation.' result = Colours.remove_colours(result) unless use_colours? opn; e result end end
reset()
click to toggle source
reset_usher_object()
click to toggle source
result?()
click to toggle source
run()
click to toggle source
set_files(i = DEFAULT_FILE)
click to toggle source
sfile(i = '')
click to toggle source
show_file_header(i)
click to toggle source
#¶ ↑
show_file_header
¶ ↑
This method will show the header, with an introduction like “From file bla”.
#¶ ↑
# File lib/class_docu_shower/class_docu_shower.rb, line 264 def show_file_header(i) if @report_the_filename# result = 'From file '+sfile(i)+':'+N+N result = Colours.remove_colours(result) unless use_colours? e result end end
show_result()
click to toggle source
#¶ ↑
show_result
¶ ↑
#¶ ↑
# File lib/class_docu_shower/class_docu_shower.rb, line 176 def show_result if @be_verbose # We will be chatty here, aka, verbose. result = 'From the file '+sfile(file?)+' we ' result = Colours.remove_colours(result) unless use_colours? opn; e result result = 'can show this result:' result = Colours.remove_colours(result) unless use_colours? opn; e result end show_the_result end
show_the_result()
click to toggle source
slateblue(i)
click to toggle source