Class: Importance::Importer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, &block) ⇒ Importer

Returns a new instance of Importer.



24
25
26
27
28
29
30
31
32
33
# File 'lib/importance/configuration.rb', line 24

def initialize(name, &block)
  @name = name
  @attributes = []
  @setup_callback = nil
  @perform_callback = nil
  @teardown_callback = nil
  @error_callback = nil
  @batch = false
  instance_eval(&block) if block_given?
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



22
23
24
# File 'lib/importance/configuration.rb', line 22

def attributes
  @attributes
end

#batchObject (readonly)

Returns the value of attribute batch.



22
23
24
# File 'lib/importance/configuration.rb', line 22

def batch
  @batch
end

#error_callbackObject (readonly)

Returns the value of attribute error_callback.



22
23
24
# File 'lib/importance/configuration.rb', line 22

def error_callback
  @error_callback
end

#nameObject (readonly)

Returns the value of attribute name.



22
23
24
# File 'lib/importance/configuration.rb', line 22

def name
  @name
end

#perform_callbackObject (readonly)

Returns the value of attribute perform_callback.



22
23
24
# File 'lib/importance/configuration.rb', line 22

def perform_callback
  @perform_callback
end

#setup_callbackObject (readonly)

Returns the value of attribute setup_callback.



22
23
24
# File 'lib/importance/configuration.rb', line 22

def setup_callback
  @setup_callback
end

#teardown_callbackObject (readonly)

Returns the value of attribute teardown_callback.



22
23
24
# File 'lib/importance/configuration.rb', line 22

def teardown_callback
  @teardown_callback
end

Instance Method Details

#attribute(key, labels) ⇒ Object



35
36
37
# File 'lib/importance/configuration.rb', line 35

def attribute(key, labels)
  @attributes << OpenStruct.new(key: key, labels: labels)
end

#batch_size(size) ⇒ Object



39
40
41
# File 'lib/importance/configuration.rb', line 39

def batch_size(size)
  @batch = size
end

#error(&block) ⇒ Object



55
56
57
# File 'lib/importance/configuration.rb', line 55

def error(&block)
  @error_callback = block
end

#perform(&block) ⇒ Object



47
48
49
# File 'lib/importance/configuration.rb', line 47

def perform(&block)
  @perform_callback = block
end

#setup(&block) ⇒ Object



43
44
45
# File 'lib/importance/configuration.rb', line 43

def setup(&block)
  @setup_callback = block
end

#teardown(&block) ⇒ Object



51
52
53
# File 'lib/importance/configuration.rb', line 51

def teardown(&block)
  @teardown_callback = block
end