class SpecTag
Attributes
comment[RW]
description[RW]
tag[RW]
Public Class Methods
new(string=nil)
click to toggle source
# File lib/mspec/runner/tag.rb, line 4 def initialize(string=nil) parse(string) if string end
Public Instance Methods
==(o)
click to toggle source
# File lib/mspec/runner/tag.rb, line 29 def ==(o) @tag == o.tag and @comment == o.comment and @description == o.description end
escape(str)
click to toggle source
# File lib/mspec/runner/tag.rb, line 20 def escape(str) str = %Q["#{str.gsub(/\n/, '\n')}"] if /\n/ =~ str str end
parse(string)
click to toggle source
# File lib/mspec/runner/tag.rb, line 8 def parse(string) m = /^([^()#:]+)(\(([^)]+)?\))?:(.*)$/.match string @tag, @comment, description = m.values_at(1, 3, 4) if m @description = unescape description end
to_s()
click to toggle source
# File lib/mspec/runner/tag.rb, line 25 def to_s "#{@tag}#{ "(#{@comment})" if @comment }:#{escape @description}" end
unescape(str)
click to toggle source
# File lib/mspec/runner/tag.rb, line 14 def unescape(str) return unless str str = str[1..-2] if str[0] == ?" and str[-1] == ?" str.gsub(/\n/, "\n") end