Sha256: e9a3ce13ddb44716b4e8b7b1e32ce46c3c40de9e08553b55d0f454553b1b363c

Contents?: true

Size: 555 Bytes

Versions: 2

Compression:

Stored size: 555 Bytes

Contents

module GrapeDoc

  class ApiDocumentation < Array

    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;alias create build

    def add(type,*args)
      self.push(create(type,*args))
    end

    def to_textile
      require 'RedCloth'
      RedCloth.new(self.map{|e| e.respond_to?(:to_textile) ? e.to_textile : e.to_s }.join("\n\n"))
    end;alias to_s to_textile

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
grape-doc-0.5.1 lib/grape/doc/doc_class.rb
grape-doc-0.5.0 lib/grape/doc/doc_class.rb