Class: CukeModeler::Model

Inherits:
Object
  • Object
show all
Includes:
Containing, Nested
Defined in:
lib/cuke_modeler/models/model.rb

Overview

A class modeling an element of a Cucumber suite.

Instance Attribute Summary

Attributes included from Nested

#parent_model

Instance Method Summary collapse

Methods included from Containing

#each_descendant, #each_model

Methods included from Nested

#get_ancestor

Constructor Details

#initialize(source_text = nil) ⇒ Model

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

Raises:

  • (ArgumentError)


13
14
15
16
17
# File 'lib/cuke_modeler/models/model.rb', line 13

def initialize(source_text = nil)
  raise(ArgumentError, "Can only create models from Strings but was given a #{source_text.class}.") if source_text && !source_text.is_a?(String)

  # This should be overridden by a child class
end

Instance Method Details

#childrenObject

Returns the model objects that belong to this model.



26
27
28
29
# File 'lib/cuke_modeler/models/model.rb', line 26

def children
  # This should be overridden by a child class
  []
end

#to_sObject

Returns a string representation of this model.



20
21
22
23
# File 'lib/cuke_modeler/models/model.rb', line 20

def to_s
  # This should be overridden by a child class
  super
end