Class: Importance::Importer
- Inherits:
-
Object
- Object
- Importance::Importer
- Defined in:
- lib/importance/configuration.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#batch ⇒ Object
readonly
Returns the value of attribute batch.
-
#error_callback ⇒ Object
readonly
Returns the value of attribute error_callback.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#perform_callback ⇒ Object
readonly
Returns the value of attribute perform_callback.
-
#setup_callback ⇒ Object
readonly
Returns the value of attribute setup_callback.
-
#teardown_callback ⇒ Object
readonly
Returns the value of attribute teardown_callback.
Instance Method Summary collapse
- #attribute(key, labels) ⇒ Object
- #batch_size(size) ⇒ Object
- #error(&block) ⇒ Object
-
#initialize(name, &block) ⇒ Importer
constructor
A new instance of Importer.
- #perform(&block) ⇒ Object
- #setup(&block) ⇒ Object
- #teardown(&block) ⇒ Object
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
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
22 23 24 |
# File 'lib/importance/configuration.rb', line 22 def attributes @attributes end |
#batch ⇒ Object (readonly)
Returns the value of attribute batch.
22 23 24 |
# File 'lib/importance/configuration.rb', line 22 def batch @batch end |
#error_callback ⇒ Object (readonly)
Returns the value of attribute error_callback.
22 23 24 |
# File 'lib/importance/configuration.rb', line 22 def error_callback @error_callback end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
22 23 24 |
# File 'lib/importance/configuration.rb', line 22 def name @name end |
#perform_callback ⇒ Object (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_callback ⇒ Object (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_callback ⇒ Object (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 |