module RoboPigeon::Documentarian

Public Class Methods

add_block(name, **options) click to toggle source
# File lib/robopigeon/documentarian.rb, line 7
def self.add_block(name, **options)
  block_desc = options[:desc]
  helpers = options[:helpers] || false
  document = get_document(block: options[:block], document: @@documents)
  document[name] = {
    block_desc: block_desc,
    includes_helpers: helpers
  }
  document[name][:params] = options[:params] if options[:params]
end
add_command(name, **options) click to toggle source
# File lib/robopigeon/documentarian.rb, line 18
def self.add_command(name, **options)
  command_desc = options[:desc]
  document = get_document(block: options[:block], document: @@documents)
  document[name] = {
    command_desc: command_desc
  }
  document[name][:params] = options[:params] if options[:params]
end
generate_docs() click to toggle source
# File lib/robopigeon/documentarian.rb, line 27
def self.generate_docs
  JSON.pretty_generate(@@documents)
end
get_document(**options) click to toggle source
# File lib/robopigeon/documentarian.rb, line 31
def self.get_document(**options)
  block = options[:block]
  document = options[:document]
  return get_document(document: document[block.shift], block: block) unless block.empty?

  document
end