Method: Hash#testify

Defined in:
lib/uttk/loaders/Loader.rb

#testify(symtbl, &block) ⇒ Object

Raises:

  • (ArgumentError)


138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/uttk/loaders/Loader.rb', line 138

def testify ( symtbl, &block )

  if size == 1 and (tab = to_a[0])[1].is_a? Hash
    name, doc = tab
    doc[:name] = name
    return doc.testify(symtbl, &block)
  end

  raise ArgumentError, "nil symtbl" if symtbl.nil?

  strategy = self[:strategy] || symtbl[:strategy]

  if strategy.nil?
    raise ArgumentError, "no strategy for this test (#{inspect})"
  end

  Uttk::Loaders.get_class(strategy).new do |t|
    t.symtbl ||= symtbl
    block[t] if block
    t.assign(self)
  end

end