Module: RoboPigeon::Documentarian
- Defined in:
- lib/robopigeon/documentarian.rb
Constant Summary collapse
- @@documents =
{}
Class Method Summary collapse
- .add_block(name, **options) ⇒ Object
- .add_command(name, **options) ⇒ Object
- .generate_docs ⇒ Object
- .get_document(**options) ⇒ Object
Class Method Details
.add_block(name, **options) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/robopigeon/documentarian.rb', line 7 def self.add_block(name, **) block_desc = [:desc] helpers = [:helpers] || false document = get_document(block: [:block], document: @@documents) document[name] = { block_desc: block_desc, includes_helpers: helpers } document[name][:params] = [:params] if [:params] end |
.add_command(name, **options) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/robopigeon/documentarian.rb', line 18 def self.add_command(name, **) command_desc = [:desc] document = get_document(block: [:block], document: @@documents) document[name] = { command_desc: command_desc } document[name][:params] = [:params] if [:params] end |
.generate_docs ⇒ Object
27 28 29 |
# File 'lib/robopigeon/documentarian.rb', line 27 def self.generate_docs JSON.pretty_generate(@@documents) end |
.get_document(**options) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/robopigeon/documentarian.rb', line 31 def self.get_document(**) block = [:block] document = [:document] return get_document(document: document[block.shift], block: block) unless block.empty? document end |