Sha256: 7e4bc2ed1723ac97912d65ffdb372c6a1db4cd1c6ec4293b4a6030d280aaa7eb

Contents?: true

Size: 981 Bytes

Versions: 1

Compression:

Stored size: 981 Bytes

Contents

module CukeModeler

  # A class modeling an element of a Cucumber suite.
  class Model

    include Nested
    include Containing


    # Creates a new Model object and, if *source_text* is provided,
    # populates the object.
    def initialize(source_text = nil)
      error_message = "Can only create models from Strings but was given a #{source_text.class}."
      raise(ArgumentError, error_message) if source_text && !source_text.is_a?(String)

      # This should be overridden by a child class
    end

    # It's a lazy implementation but it's mandatory for the class to define this method
    # rubocop:disable Lint/UselessMethodDefinition

    # Returns a string representation of this model.
    def to_s
      # This should be overridden by a child class
      super
    end

    # rubocop:enable Lint/UselessMethodDefinition

    # Returns the model objects that belong to this model.
    def children
      []
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cuke_modeler-3.19.0 lib/cuke_modeler/models/model.rb