importeer_plan 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/lib/importeer_plan/version.rb +1 -1
- data/lib/importeer_plan.rb +6 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c70544dfc2c27e2b90e4796c393d03d06596ff28
|
4
|
+
data.tar.gz: 3c21e31292c1ab35bdb465383ee6a9bac67e2007
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63ea85d41f1bb6cad947da5e5ab47a6c8947bea266e351937572c43b59d26cd4d32a827bc0c1fa996b4c9c6ea7d3aced56d20e18d35db692d9192f47a7e0ca7b
|
7
|
+
data.tar.gz: 355a289c8d30ac50d30af7fe7d2da8724828811d21b15673e3724feea31f5f04e82ba2a7c1eca70a2084d470cf2df3d1c3b16bb22400a9e350b14e955e6ca3ba
|
data/README.md
CHANGED
@@ -25,7 +25,11 @@ Or install it yourself as:
|
|
25
25
|
Importeer.new takes two options:
|
26
26
|
|
27
27
|
* name (string)
|
28
|
-
*
|
28
|
+
* an options-hash
|
29
|
+
|
30
|
+
* size of batch_of_lines_to_import (size_batch, integer, optional, defaults to 1000)
|
31
|
+
* type of separator for csv-files (sep, string, optional, defaults to ";")
|
32
|
+
* method of import: initial or replacing (initial, false or true, optional, defaults to false)
|
29
33
|
|
30
34
|
|
31
35
|
My applications-classes for processing data from external files inherit from Importeer, depending the file-type:
|
@@ -38,7 +42,7 @@ My applications-classes for processing data from external files inherit from Imp
|
|
38
42
|
```ruby
|
39
43
|
class ImporteerSomething < ImporteerPlan::MyXls
|
40
44
|
attr_accessor :my_var, :another_var
|
41
|
-
#call importeer("filename") to import the file in batches of 1000, optional importeer("filename",
|
45
|
+
#call importeer("filename") to import the file in batches of 1000, optional importeer("filename", {size_batch: 1234})
|
42
46
|
|
43
47
|
def initialize(*)
|
44
48
|
super
|
data/lib/importeer_plan.rb
CHANGED
@@ -4,15 +4,17 @@ module ImporteerPlan
|
|
4
4
|
class Importeer
|
5
5
|
|
6
6
|
|
7
|
-
attr_accessor :path, :name, :dir, :size_batch
|
7
|
+
attr_accessor :path, :name, :dir, :size_batch, :sep, :initial
|
8
8
|
#call importeer("filename") to import the file in batches of 1000, optional importeer("filename", size_)
|
9
9
|
|
10
10
|
|
11
11
|
|
12
|
-
def initialize(name,
|
12
|
+
def initialize(name, options = {size_batch: 1000, sep: ";", initial: false})
|
13
13
|
@name = name
|
14
14
|
@path = Importeer.dir.join( @name )
|
15
|
-
@size_batch = size_batch#||1000
|
15
|
+
@size_batch = options[:size_batch]#||1000
|
16
|
+
@sep = options[:sep]
|
17
|
+
@initial = options[:initial]
|
16
18
|
end
|
17
19
|
|
18
20
|
def self.dir
|
@@ -51,7 +53,7 @@ module ImporteerPlan
|
|
51
53
|
require 'csv'
|
52
54
|
def initialize(*)
|
53
55
|
super
|
54
|
-
@sep =
|
56
|
+
# @sep = options[:sep]
|
55
57
|
end
|
56
58
|
|
57
59
|
def bron
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: importeer_plan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rolf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spreadsheet
|
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
160
|
version: '0'
|
161
161
|
requirements: []
|
162
162
|
rubyforge_project:
|
163
|
-
rubygems_version: 2.4.
|
163
|
+
rubygems_version: 2.4.8
|
164
164
|
signing_key:
|
165
165
|
specification_version: 4
|
166
166
|
summary: only purpose is provide some reusable defaults for processing my (.xls-,
|