Class: Linkage::Configuration::DSL
- Inherits:
-
Object
- Object
- Linkage::Configuration::DSL
show all
- Defined in:
- lib/linkage/configuration.rb
Defined Under Namespace
Classes: ComparatorWrapper, DataWrapper, DatasetWrapper, ExpectationWrapper, FieldWrapper, FunctionWrapper, VisualComparisonWrapper
Instance Method Summary
collapse
Constructor Details
#initialize(config, &block) ⇒ DSL
Returns a new instance of DSL.
199
200
201
202
203
204
|
# File 'lib/linkage/configuration.rb', line 199
def initialize(config, &block)
@config = config
@lhs_filters = []
@rhs_filters = []
instance_eval(&block)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
|
# File 'lib/linkage/configuration.rb', line 279
def method_missing(name, *args, &block)
md = name.to_s.match(/^be_(.+)$/)
if md
klass = Comparator[md[1]]
if klass
ComparatorWrapper.new(self, klass, args)
else
super
end
else
klass = Function[name.to_s]
if klass
FunctionWrapper.new(self, klass, args)
else
super
end
end
end
|
Instance Method Details
#add_exhaustive_expectation(expectation) ⇒ Object
252
253
254
255
256
257
|
# File 'lib/linkage/configuration.rb', line 252
def add_exhaustive_expectation(expectation)
@config.add_exhaustive_expectation(expectation)
if @config.linkage_type == :self
@config.linkage_type = expectation.kind
end
end
|
#add_simple_expectation(expectation) ⇒ Object
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
|
# File 'lib/linkage/configuration.rb', line 223
def add_simple_expectation(expectation)
@config.add_simple_expectation(expectation)
if @config.linkage_type == :self
case expectation.kind
when :cross
@config.linkage_type = :cross
when :filter
these_filters, other_filters =
case expectation.side
when :lhs
[@lhs_filters, @rhs_filters]
when :rhs
[@rhs_filters, @lhs_filters]
end
these_filters << expectation
other_filters.each do |other|
if !expectation.same_except_side?(other)
@config.linkage_type = :cross
break
end
end
end
end
end
|
#add_visual_comparison(visual_comparison) ⇒ Object
259
260
261
|
# File 'lib/linkage/configuration.rb', line 259
def add_visual_comparison(visual_comparison)
@config.visual_comparisons << visual_comparison
end
|
#groups_table_name(new_name) ⇒ Object
263
264
265
|
# File 'lib/linkage/configuration.rb', line 263
def groups_table_name(new_name)
@config.groups_table_name = new_name
end
|
#lhs ⇒ Object
206
207
208
|
# File 'lib/linkage/configuration.rb', line 206
def lhs
DatasetWrapper.new(self, :lhs, @config.dataset_1)
end
|
#matches_table_name(new_name) ⇒ Object
275
276
277
|
# File 'lib/linkage/configuration.rb', line 275
def matches_table_name(new_name)
@config.matches_table_name = new_name
end
|
#original_groups_table_name(new_name) ⇒ Object
267
268
269
|
# File 'lib/linkage/configuration.rb', line 267
def original_groups_table_name(new_name)
@config.original_groups_table_name = new_name
end
|
#rhs ⇒ Object
210
211
212
|
# File 'lib/linkage/configuration.rb', line 210
def rhs
DatasetWrapper.new(self, :rhs, @config.dataset_2)
end
|
#save_results_in(uri, options = {}) ⇒ Object
214
215
216
217
|
# File 'lib/linkage/configuration.rb', line 214
def save_results_in(uri, options = {})
@config.results_uri = uri
@config.results_uri_options = options
end
|
#scores_table_name(new_name) ⇒ Object
271
272
273
|
# File 'lib/linkage/configuration.rb', line 271
def scores_table_name(new_name)
@config.scores_table_name = new_name
end
|
#set_record_cache_size(num) ⇒ Object
219
220
221
|
# File 'lib/linkage/configuration.rb', line 219
def set_record_cache_size(num)
@config.record_cache_size = num
end
|