Sha256: 11ee9618c2708ca61a204b096bddea599dea5c7c28e8d9149dfec6c3c0288199
Contents?: true
Size: 1.16 KB
Versions: 13
Compression:
Stored size: 1.16 KB
Contents
module CukeModeler # A class modeling a tag. class Tag < Model include Parsing include Parsed include Sourceable # The name of the tag attr_accessor :name # Creates a new Tag object and, if *source_text* is provided, populates the # object. def initialize(source_text = nil) super(source_text) return unless source_text parsed_tag_data = parse_source(source_text) populate_tag(self, parsed_tag_data) end # Returns a string representation of this model. For a tag model, # this will be Gherkin text that is equivalent to the tag being modeled. def to_s name || '' end private def parse_source(source_text) base_file_string = "\n#{dialect_feature_keyword}: Fake feature to parse" source_text = "# language: #{Parsing.dialect}\n" + source_text + base_file_string parsed_file = Parsing.parse_text(source_text, 'cuke_modeler_stand_alone_tag.feature') parsed_file['feature']['tags'].first end def populate_name(model, parsed_model_data) model.name = parsed_model_data['name'] end end end
Version data entries
13 entries across 13 versions & 1 rubygems