Class: Documentize::Documentize
- Inherits:
-
Object
- Object
- Documentize::Documentize
- Defined in:
- lib/documentize.rb
Constant Summary collapse
- REGEX =
{ ext: /\.rb$|\.ru$/, shbang: /^#!.*?ruby$/ }
Instance Attribute Summary collapse
-
#collector ⇒ Object
readonly
Returns the value of attribute collector.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#informator ⇒ Object
readonly
Returns the value of attribute informator.
-
#tree ⇒ Object
readonly
Returns the value of attribute tree.
Instance Method Summary collapse
-
#initialize(file_name) ⇒ Documentize
constructor
A new instance of Documentize.
- #load_file(file_name) ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(file_name) ⇒ Documentize
Returns a new instance of Documentize.
18 19 20 21 22 |
# File 'lib/documentize.rb', line 18 def initialize(file_name) @file = load_file(file_name) @collector = Collector.new @informator = Informator.new end |
Instance Attribute Details
#collector ⇒ Object (readonly)
Returns the value of attribute collector.
16 17 18 |
# File 'lib/documentize.rb', line 16 def collector @collector end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
16 17 18 |
# File 'lib/documentize.rb', line 16 def file @file end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
16 17 18 |
# File 'lib/documentize.rb', line 16 def header @header end |
#informator ⇒ Object (readonly)
Returns the value of attribute informator.
16 17 18 |
# File 'lib/documentize.rb', line 16 def informator @informator end |
#tree ⇒ Object (readonly)
Returns the value of attribute tree.
16 17 18 |
# File 'lib/documentize.rb', line 16 def tree @tree end |
Instance Method Details
#load_file(file_name) ⇒ Object
24 25 26 27 28 |
# File 'lib/documentize.rb', line 24 def load_file(file_name) file = File.readlines(file_name).map {|line| line.strip} - [""] raise ArgumentError unless valid?(file_name, file[0]) file end |
#run ⇒ Object
30 31 32 33 34 35 |
# File 'lib/documentize.rb', line 30 def run @tree, @header = collector.run(@file) informator.gen_info(tree) informator.clear_screen Printer.print_with_docs(tree) end |