Module: Neo4jr::SelfDocumentor
- Defined in:
- lib/neo4jr-social/self_documentor.rb
Class Method Summary collapse
- .capture(text) ⇒ Object
- .optional_param(*args) ⇒ Object
- .output ⇒ Object
- .required_param(*args) ⇒ Object
- .route_added(verb, path, proc) ⇒ Object
Instance Method Summary collapse
Class Method Details
.capture(text) ⇒ Object
24 25 26 |
# File 'lib/neo4jr-social/self_documentor.rb', line 24 def self.capture(text) @capture = text end |
.optional_param(*args) ⇒ Object
19 20 21 22 |
# File 'lib/neo4jr-social/self_documentor.rb', line 19 def self.optional_param(*args) args.unshift(:note) if args.size == 1 (@capture_optional_param ||= []) << {args.first => args.last} end |
.output ⇒ Object
39 40 41 |
# File 'lib/neo4jr-social/self_documentor.rb', line 39 def self.output @@document end |
.required_param(*args) ⇒ Object
15 16 17 |
# File 'lib/neo4jr-social/self_documentor.rb', line 15 def self.required_param(*args) (@capture_required_param ||= []) << {args.first => args.last} end |
.route_added(verb, path, proc) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/neo4jr-social/self_documentor.rb', line 28 def self.route_added(verb, path, proc) if [:get, :post, :put, :delete].include?(verb.downcase.to_sym) document = {:path => path, :description => verb.upcase.to_sym.to_s + ": " + (@capture || '').to_s} document[:required] = @capture_required_param if @capture_required_param document[:optional] = @capture_optional_param if @capture_optional_param (@@document ||= []) << document @capture_optional_param = nil @capture_required_param = nil end end |
Instance Method Details
#describe(info) ⇒ Object
3 4 5 |
# File 'lib/neo4jr-social/self_documentor.rb', line 3 def describe(info) SelfDocumentor.capture info end |
#optional_param(*args) ⇒ Object
11 12 13 |
# File 'lib/neo4jr-social/self_documentor.rb', line 11 def optional_param(*args) SelfDocumentor.optional_param(*args) end |
#required_param(*args) ⇒ Object
7 8 9 |
# File 'lib/neo4jr-social/self_documentor.rb', line 7 def required_param(*args) SelfDocumentor.required_param(*args) end |