class Documentize::Informator

Public Instance Methods

branch_info(branch, parent = nil) click to toggle source
# File lib/documentize/informator.rb, line 8
def branch_info(branch, parent = nil)

  display_branch(branch, parent)

  branch[:desc] = get_desc(branch[:type])

  get_args(branch) if branch[:args]

  branch[:content].each do |item|
    branch_info(item, [branch[:name], branch[:type]]) if item.is_a?(Hash)
  end

end
clear_screen() click to toggle source
# File lib/documentize/informator.rb, line 4
def clear_screen
  system("cls") || system("tput reset") || system("clear") || puts("\e[H\e[2J")
end
display_branch(branch, parent = nil) click to toggle source
# File lib/documentize/informator.rb, line 22
def display_branch(branch, parent = nil)
  clear_screen unless parent

  puts line_break

  print "Describing: #{branch[:name]} #{branch[:type]}"
  print " of #{parent[0]} #{parent[1]}" if parent
  puts

  puts line_break

  puts Builder.build_code(branch)
end
gen_doc(branch) click to toggle source
# File lib/documentize/informator.rb, line 36
def gen_doc(branch)
  branch[:content].each do |item|
    gen_doc(item) if item.is_a?(Hash)
  end
  branch[:doc] = Builder.build_docs(branch)
end
gen_info(tree) click to toggle source
# File lib/documentize/informator.rb, line 43
def gen_info(tree)

  tree.each do |branch|
    branch_info(branch)
    gen_doc(branch)
  end

end
get_args(branch) click to toggle source
# File lib/documentize/informator.rb, line 52
def get_args(branch)

  print "#{branch[:type]} #{branch[:name]}"
  print Builder.build_args(branch[:args])
  puts

  branch[:args].each do |arg|

    puts "Please enter a brief description of argument: #{arg[:name]}"
    arg[:desc] = gets.strip

    puts "What input Type should be entered for agument: #{arg[:name]}"
    arg[:type] = gets.strip

    if arg[:default] == nil
      puts "Please enter a default 'testing' value for Rspec:"
      arg[:test] = gets.strip
    end

  end

  branch[:args]
end
get_desc(type) click to toggle source
# File lib/documentize/informator.rb, line 76
def get_desc(type)

  puts "please enter a description of the above #{type}\n\n"
  gets.strip

end
line_break() click to toggle source
# File lib/documentize/informator.rb, line 85
def line_break
  puts
  puts "--------------------------------------------------"
end