Class: GrapeDoc::ApiDocParts::ArrayBasic

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

Direct Known Subclasses

ArrayObject

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ ArrayBasic

Returns a new instance of ArrayBasic.



83
84
85
86
# File 'lib/grape/doc/prototype.rb', line 83

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

Class Method Details

.markdownObject



78
79
80
# File 'lib/grape/doc/prototype.rb', line 78

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

.markdown=(obj) ⇒ Object



75
76
77
# File 'lib/grape/doc/prototype.rb', line 75

def markdown=(obj)
  @markdown=obj
end

Instance Method Details

#markdownObject



88
89
90
# File 'lib/grape/doc/prototype.rb', line 88

def markdown
  self.class.markdown
end

#to_textileObject



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/grape/doc/prototype.rb', line 92

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