Class: Linkage::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/linkage/configuration.rb

Defined Under Namespace

Classes: DSL

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dataset_1, dataset_2) ⇒ Configuration

Returns a new instance of Configuration.



307
308
309
310
311
312
313
# File 'lib/linkage/configuration.rb', line 307

def initialize(dataset_1, dataset_2)
  @dataset_1 = dataset_1
  @dataset_2 = dataset_2
  @expectations = []
  @visual_comparisons = []
  @linkage_type = dataset_1 == dataset_2 ? :self : :dual
end

Instance Attribute Details

#dataset_1Object (readonly)

Returns the value of attribute dataset_1.



304
305
306
# File 'lib/linkage/configuration.rb', line 304

def dataset_1
  @dataset_1
end

#dataset_2Object (readonly)

Returns the value of attribute dataset_2.



304
305
306
# File 'lib/linkage/configuration.rb', line 304

def dataset_2
  @dataset_2
end

#expectationsObject (readonly)

Returns the value of attribute expectations.



304
305
306
# File 'lib/linkage/configuration.rb', line 304

def expectations
  @expectations
end

#linkage_typeObject

Returns the value of attribute linkage_type.



305
306
307
# File 'lib/linkage/configuration.rb', line 305

def linkage_type
  @linkage_type
end

#results_uriObject

Returns the value of attribute results_uri.



305
306
307
# File 'lib/linkage/configuration.rb', line 305

def results_uri
  @results_uri
end

#results_uri_optionsObject

Returns the value of attribute results_uri_options.



305
306
307
# File 'lib/linkage/configuration.rb', line 305

def results_uri_options
  @results_uri_options
end

#visual_comparisonsObject (readonly)

Returns the value of attribute visual_comparisons.



304
305
306
# File 'lib/linkage/configuration.rb', line 304

def visual_comparisons
  @visual_comparisons
end

Instance Method Details

#configure(&block) ⇒ Object



315
316
317
# File 'lib/linkage/configuration.rb', line 315

def configure(&block)
  DSL.new(self, &block)
end

#groups_table_schemaObject



319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/linkage/configuration.rb', line 319

def groups_table_schema
  schema = []

  # add id
  schema << [:id, Integer, {:primary_key => true}]

  # add values
  @expectations.each do |exp|
    next  if exp.kind == :filter

    merged_field = exp.merged_field
    merged_type = merged_field.ruby_type
    schema << [merged_field.name, merged_type[:type], merged_type[:opts] || {}]
  end

  schema
end

#result_setObject



337
338
339
# File 'lib/linkage/configuration.rb', line 337

def result_set
  @result_set ||= ResultSet.new(self)
end