Module: GrapeDoc::Parser
- Defined in:
- lib/grape/doc/parser.rb
Class Method Summary collapse
Class Method Details
.format_parse(text, *args) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/grape/doc/parser.rb', line 27 def format_parse(text,*args) text = text.dup.to_s args.each do |command| case command.to_s.downcase when /^bold/ text.replace("*#{text}*") when /^italic/ text.replace("__#{text}__") when /^underlined/ text.replace("+#{text}+") when /^superscript/ text.replace("^#{text}^") end end;return text end |
.parse(object) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/grape/doc/parser.rb', line 5 def parse(object) case object when Array object.map{|e| case e when Array e.dup else self.format_parse(*e) end } else # self.format_parse(object) object end end |
.typer(obj) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/grape/doc/parser.rb', line 49 def typer(obj) case obj when Array obj.map{ |e| typer(e) } when Hash obj.reduce({}){|m,o| m.merge!(o[0] => typer(o[1]) ) ;m} when Class,Module obj.to_s when String if -> { Helpers.constantize(obj) rescue false }.call if obj.to_s == 'TEST' 'String' else obj.to_s end else 'String' end else obj.class.to_s end end |