Sha256: 169e148c99b2a38a4bf40e89158d69d1dcdd05e48c7733fd78ea05eae0b9df76
Contents?: true
Size: 711 Bytes
Versions: 178
Compression:
Stored size: 711 Bytes
Contents
class SpecTag attr_accessor :tag, :comment, :description def initialize(string=nil) parse(string) if string end def parse(string) m = /^([^()#:]+)(\(([^)]+)?\))?:(.*)$/.match string @tag, @comment, description = m.values_at(1, 3, 4) if m @description = unescape description end def unescape(str) return unless str str = str[1..-2] if str[0] == ?" and str[-1] == ?" str.gsub(/\\n/, "\n") end def escape(str) str = %["#{str.gsub(/\n/, '\n')}"] if /\n/ =~ str str end def to_s "#{@tag}#{ "(#{@comment})" if @comment }:#{escape @description}" end def ==(o) @tag == o.tag and @comment == o.comment and @description == o.description end end
Version data entries
178 entries across 154 versions & 4 rubygems