Class: Janko::Import
- Inherits:
-
Object
- Object
- Janko::Import
- Includes:
- Agrippa::MutableHash
- Defined in:
- lib/janko/import.rb
Instance Method Summary collapse
- #columns(*columns) ⇒ Object
- #connect(connection) ⇒ Object
- #default_state ⇒ Object
- #push(values) ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
- #use(importer) ⇒ Object
Instance Method Details
#columns(*columns) ⇒ Object
38 39 40 41 |
# File 'lib/janko/import.rb', line 38 def columns(*columns) @state[:columns] = columns.flatten self end |
#connect(connection) ⇒ Object
28 29 30 31 |
# File 'lib/janko/import.rb', line 28 def connect(connection) @state[:connection] = Connection.build(connection) self end |
#default_state ⇒ Object
24 25 26 |
# File 'lib/janko/import.rb', line 24 def default_state { columns: Janko::ALL, importer: Janko::CopyImporter } end |
#push(values) ⇒ Object
49 50 51 52 53 |
# File 'lib/janko/import.rb', line 49 def push(values) raise("Call #start before #push") unless @state[:started] delegate.push(values) self end |
#start ⇒ Object
43 44 45 46 47 |
# File 'lib/janko/import.rb', line 43 def start @state[:started] = true delegate.start self end |
#stop ⇒ Object
55 56 57 58 59 60 |
# File 'lib/janko/import.rb', line 55 def stop raise("Call #start before #stop") unless @state[:started] delegate.stop @state[:started] = false self end |
#use(importer) ⇒ Object
33 34 35 36 |
# File 'lib/janko/import.rb', line 33 def use(importer) @state[:importer] = importer self end |