Class: ProbeDockProbe::Annotation

Inherits:
Object
  • Object
show all
Defined in:
lib/probe_dock_ruby/annotation.rb

Constant Summary collapse

BASE_REGEXP_STRING =
'@probedock\(([^\(\)]*)\)'
ANNOTATION_REGEXP =
/#{BASE_REGEXP_STRING}/
STRIP_ANNOTATION_REGEXP =
/\s*#{BASE_REGEXP_STRING}/

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ Annotation

Returns a new instance of Annotation.



9
10
11
# File 'lib/probe_dock_ruby/annotation.rb', line 9

def initialize(str)
  parse(str)
end

Instance Attribute Details

#activeObject (readonly)

Returns the value of attribute active.



7
8
9
# File 'lib/probe_dock_ruby/annotation.rb', line 7

def active
  @active
end

#categoryObject (readonly)

Returns the value of attribute category.



7
8
9
# File 'lib/probe_dock_ruby/annotation.rb', line 7

def category
  @category
end

#keyObject (readonly)

Returns the value of attribute key.



7
8
9
# File 'lib/probe_dock_ruby/annotation.rb', line 7

def key
  @key
end

#tagsObject (readonly)

Returns the value of attribute tags.



7
8
9
# File 'lib/probe_dock_ruby/annotation.rb', line 7

def tags
  @tags
end

#ticketsObject (readonly)

Returns the value of attribute tickets.



7
8
9
# File 'lib/probe_dock_ruby/annotation.rb', line 7

def tickets
  @tickets
end

Class Method Details

.strip_annotations(test_name) ⇒ Object



22
23
24
# File 'lib/probe_dock_ruby/annotation.rb', line 22

def self.strip_annotations(test_name)
  test_name.gsub(STRIP_ANNOTATION_REGEXP, '')
end

Instance Method Details

#merge!(annotation) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/probe_dock_ruby/annotation.rb', line 13

def merge!(annotation)
  @key = annotation.key if annotation.key
  @category = annotation.category if annotation.category
  @active = annotation.active unless annotation.active.nil?
  @tags = (@tags + annotation.tags).compact.collect(&:to_s).uniq
  @tickets = (@tickets + annotation.tickets).compact.collect(&:to_s).uniq
  self
end