Class: Fix::Set Private

Inherits:
Object
  • Object
show all
Defined in:
lib/fix/set.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Collection of specifications.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*contexts) ⇒ Set

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize a new Set with given contexts.

Parameters:

  • contexts (Array<::Fix::Dsl>)

    The list of contexts document.



29
30
31
# File 'lib/fix/set.rb', line 29

def initialize(*contexts)
  @specs = Doc.extract_specifications(*contexts).shuffle
end

Instance Attribute Details

#specsArray (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns A list of specifications.

Returns:

  • (Array)

    A list of specifications.



14
15
16
# File 'lib/fix/set.rb', line 14

def specs
  @specs
end

Class Method Details

.load(name) ⇒ Set

Load specifications from a constant name.

Parameters:

  • name (String, Symbol)

    The constant name of the specifications.

Returns:

  • (Set)

    A new Set instance containing the loaded specifications.



22
23
24
# File 'lib/fix/set.rb', line 22

def self.load(name)
  new(*Doc.fetch(name))
end

Instance Method Details

#test { ... } ⇒ Boolean

Run the test suite against the provided subject.

Yields:

  • The block of code to be tested

Yield Returns:

  • (Object)

    The result of the code being tested

Returns:

  • (Boolean)

    true if all tests pass, exits with false otherwise

Raises:

  • (::SystemExit)

    The test set failed!



41
42
43
# File 'lib/fix/set.rb', line 41

def test(&)
  suite_passed?(&) || ::Kernel.exit(false)
end