Class: CukeModeler::Tag

Inherits:
Model
  • Object
show all
Includes:
Parsed, Parsing, Sourceable
Defined in:
lib/cuke_modeler/models/tag.rb

Overview

A class modeling a tag.

Instance Attribute Summary collapse

Attributes included from Sourceable

#source_line

Attributes included from Parsed

#parsing_data

Attributes included from Nested

#parent_model

Instance Method Summary collapse

Methods included from Parsing

dialects, parse_text

Methods inherited from Model

#children

Methods included from Nested

#get_ancestor

Constructor Details

#initialize(source_text = nil) ⇒ Tag

Creates a new Tag object and, if source_text is provided, populates the object.



18
19
20
21
22
23
24
25
# File 'lib/cuke_modeler/models/tag.rb', line 18

def initialize(source_text = nil)
  super(source_text)

  if source_text
    parsed_tag_data = parse_source(source_text)
    populate_tag(self, parsed_tag_data)
  end
end

Instance Attribute Details

#nameObject

The name of the tag



13
14
15
# File 'lib/cuke_modeler/models/tag.rb', line 13

def name
  @name
end

Instance Method Details

#to_sObject

Returns a string representation of this model. For a tag model, this will be Gherkin text that is equivalent to the tag being modeled.



29
30
31
# File 'lib/cuke_modeler/models/tag.rb', line 29

def to_s
  name || ''
end