Class: GrapeDoc::ApiDocParts::ArrayObject

Inherits:
Array
  • Object
show all
Defined in:
lib/grape/doc/prototype.rb

Direct Known Subclasses

List, Table

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ ArrayObject

Returns a new instance of ArrayObject.



55
56
57
58
# File 'lib/grape/doc/prototype.rb', line 55

def initialize(object)
  object = Parser.parse(object)
  self.replace(object)
end

Class Method Details

.markdownObject



50
51
52
# File 'lib/grape/doc/prototype.rb', line 50

def markdown
  @markdown || self.to_s.downcase
end

.markdown=(obj) ⇒ Object



47
48
49
# File 'lib/grape/doc/prototype.rb', line 47

def markdown=(obj)
  @markdown=obj
end

Instance Method Details

#markdownObject



60
61
62
# File 'lib/grape/doc/prototype.rb', line 60

def markdown
  self.class.markdown
end

#to_textileObject



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/grape/doc/prototype.rb', line 64

def to_textile
  self.map{|e|
    case e

      when ArrayObject
        e.map{|e|

          text = if e.respond_to?(:to_textile)
                   e.to_textile
                 else
                   e.to_s
                 end

          "#{markdown}#{markdown} #{text}"

        }.join("\n")

      else
        "#{markdown} #{e}"

    end
  }.join("\n")
end