Module: Assay

Defined in:
lib/assay.rb,
lib/assay/assertor.rb,
lib/assay/assertable.rb

Defined Under Namespace

Modules: Assertable, Assertions, Extensions, Matchers Classes: Assertor

Class Method Summary collapse

Class Method Details

.assertionsObject

Returns a list of Assertion subclasses.



31
32
33
# File 'lib/assay.rb', line 31

def self.assertions
  Assertion.subclasses
end

.color=(boolean) ⇒ Object

Set ANSI color mode. Default is false, so set to ‘true` to get ANSI color in some error messages.

Examples:

Assay.color = true


42
43
44
45
46
47
48
49
# File 'lib/assay.rb', line 42

def self.color=(boolean)
  if boolean
    require 'ansi/diff'
    $ansi = true
  else
    $ansi = false
  end 
end

.const_missing(name) ⇒ Object

Check metadata for missing constants.



24
25
26
# File 'lib/assay.rb', line 24

def self.const_missing(name)
  [name.to_s.downcase] || super(name)
end

.lookup(symbol) ⇒ Object

Lookup assay class by operator or name.



54
55
56
# File 'lib/assay.rb', line 54

def self.lookup(symbol)
  lookup_by_operator(symbol) || lookup_by_name(symbol)
end

.lookup_by_name(name = nil) ⇒ Object

If operator is not given, returns a hash table of assertion classes indexed by assertive name.



70
71
72
# File 'lib/assay.rb', line 70

def self.lookup_by_name(name=nil)
  Assertion.by_name(name)
end

.lookup_by_operator(operator = nil) ⇒ Object

If operator is not given, returns a hash table of assertion classes indexed by operator.



62
63
64
# File 'lib/assay.rb', line 62

def self.lookup_by_operator(operator=nil)
  Assertion.by_operator(operator)
end

.metadataObject

Returns Hash table of project metadata.



14
15
16
17
18
19
# File 'lib/assay.rb', line 14

def self.
  @spec ||= (
    require 'yaml'
    YAML.load(File.new(File.dirname(__FILE__) + '/assay.yml'))
  )
end