Sha256: 3bdfba909e373f3fcadb8257a7962331d83a48718da9291c94258461df235308

Contents?: true

Size: 447 Bytes

Versions: 14

Compression:

Stored size: 447 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
  end

  def to_s
    "#{@tag}#{ "(#{@comment})" if @comment }:#{@description}"
  end

  def ==(o)
    @tag == o.tag and @comment == o.comment and @description == o.description
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mspec-1.0.0 lib/mspec/runner/tag.rb
mspec-1.2.0 lib/mspec/runner/tag.rb
mspec-1.5.3 lib/mspec/runner/tag.rb
mspec-1.5.2 lib/mspec/runner/tag.rb
mspec-1.5.0 lib/mspec/runner/tag.rb
mspec-1.1.1 lib/mspec/runner/tag.rb
mspec-1.3.1 lib/mspec/runner/tag.rb
mspec-1.5.1 lib/mspec/runner/tag.rb
mspec-1.4.0 lib/mspec/runner/tag.rb
mspec-1.5.4 lib/mspec/runner/tag.rb
mspec-1.1.0 lib/mspec/runner/tag.rb
mspec-1.3.0 lib/mspec/runner/tag.rb
mspec-1.5.5 lib/mspec/runner/tag.rb
mspec-1.5.6 lib/mspec/runner/tag.rb