Class: GrapeDoc::ApiDocumentation
- Inherits:
-
Array
- Object
- Array
- GrapeDoc::ApiDocumentation
- Defined in:
- lib/grape/doc/doc_class.rb
Instance Method Summary collapse
- #add(type, *args) ⇒ Object
- #build(type, *args) ⇒ Object (also: #create)
- #to_textile ⇒ Object (also: #to_s)
Instance Method Details
#add(type, *args) ⇒ Object
10 11 12 |
# File 'lib/grape/doc/doc_class.rb', line 10 def add(type,*args) self.push(create(type,*args)) end |
#build(type, *args) ⇒ Object Also known as: create
5 6 7 8 |
# File 'lib/grape/doc/doc_class.rb', line 5 def build(type,*args) raise(ArgumentError,'invalid type') unless [String,Symbol].any?{ |klass| type.class <= klass } return Helpers.constantize("GrapeDoc::ApiDocParts::#{Helpers.camelize(type)}").new(*args) end |
#to_textile ⇒ Object Also known as: to_s
14 15 16 17 |
# File 'lib/grape/doc/doc_class.rb', line 14 def to_textile require 'RedCloth' RedCloth.new(self.map{|e| e.to_textile }.join("\n\n")) end |