Class: SpecTag
Instance Attribute Summary collapse
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#description ⇒ Object
Returns the value of attribute description.
-
#tag ⇒ Object
Returns the value of attribute tag.
Instance Method Summary collapse
- #==(o) ⇒ Object
-
#initialize(string = nil) ⇒ SpecTag
constructor
A new instance of SpecTag.
- #parse(string) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(string = nil) ⇒ SpecTag
Returns a new instance of SpecTag.
4 5 6 |
# File 'lib/mspec/runner/tag.rb', line 4 def initialize(string=nil) parse(string) if string end |
Instance Attribute Details
#comment ⇒ Object
Returns the value of attribute comment.
2 3 4 |
# File 'lib/mspec/runner/tag.rb', line 2 def comment @comment end |
#description ⇒ Object
Returns the value of attribute description.
2 3 4 |
# File 'lib/mspec/runner/tag.rb', line 2 def description @description end |
#tag ⇒ Object
Returns the value of attribute tag.
2 3 4 |
# File 'lib/mspec/runner/tag.rb', line 2 def tag @tag end |
Instance Method Details
#==(o) ⇒ Object
17 18 19 |
# File 'lib/mspec/runner/tag.rb', line 17 def ==(o) @tag == o.tag and @comment == o.comment and @description == o.description end |
#parse(string) ⇒ Object
8 9 10 11 |
# 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 end |
#to_s ⇒ Object
13 14 15 |
# File 'lib/mspec/runner/tag.rb', line 13 def to_s "#{@tag}#{ "(#{@comment})" if @comment }:#{@description}" end |