virgola 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/{README.rdoc → README.textile} +17 -3
- data/lib/virgola/version.rb +1 -1
- data/virgola.gemspec +3 -3
- metadata +10 -10
data/Gemfile.lock
CHANGED
@@ -1,18 +1,29 @@
|
|
1
|
-
|
1
|
+
h1. virgola
|
2
2
|
|
3
3
|
CSV to object mapping library.
|
4
4
|
|
5
|
-
|
5
|
+
h2. Author
|
6
|
+
"Vicente Reig Rincón de Arellano":http://twitter.com/vicentereig
|
7
|
+
|
8
|
+
|
9
|
+
h2. Installation
|
10
|
+
|
11
|
+
gem install virgola
|
12
|
+
|
13
|
+
h2. Usage
|
6
14
|
|
7
15
|
Given the following CSV file
|
8
16
|
|
17
|
+
<pre lang="csv">
|
9
18
|
id,name,email
|
10
19
|
1,"Chris Floess",chris@propertybase.com
|
11
20
|
2,"Konstantin Krauss",konstantin@propertybase.com
|
12
21
|
3,"Vicente Reig",vicente@propertybase.com
|
22
|
+
</pre>
|
13
23
|
|
14
24
|
You map it to an array of Person objects.
|
15
25
|
|
26
|
+
<pre lang="ruby">
|
16
27
|
class Person
|
17
28
|
include Virgola
|
18
29
|
|
@@ -37,10 +48,13 @@ You map it to an array of Person objects.
|
|
37
48
|
puts 'yes, victory!'
|
38
49
|
end
|
39
50
|
end
|
51
|
+
</pre>
|
40
52
|
|
41
53
|
You can parse and map the file with the initial Extraction API:
|
42
54
|
|
55
|
+
<pre lang="ruby">
|
43
56
|
Person.parse(csv_contents).all # Array of Person instances mapping the guys above
|
44
57
|
Person.parse(csv_contents).count # 3
|
45
58
|
Person.parse(csv_contents).each { |pip| # do stuff }
|
46
|
-
Person.parse(csv_contents).in_groups_of(100) { |pips| # do stuff }
|
59
|
+
Person.parse(csv_contents).in_groups_of(100) { |pips| # do stuff }
|
60
|
+
</pre>
|
data/lib/virgola/version.rb
CHANGED
data/virgola.gemspec
CHANGED
@@ -8,13 +8,13 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.version = Virgola::VERSION
|
9
9
|
s.summary = 'An attempt to make CSV parsing and mapping suck less.'
|
10
10
|
s.description = 'Virgola is a CSV to Ruby objects mapper.'
|
11
|
-
s.files = Dir.glob("{lib,spec}/**/*") + %w[License Rakefile README.
|
11
|
+
s.files = Dir.glob("{lib,spec}/**/*") + %w[License Rakefile README.textile]
|
12
12
|
s.required_ruby_version = '>= 1.9.2'
|
13
13
|
s.required_rubygems_version = '>= 1.8.11'
|
14
14
|
|
15
15
|
s.author = 'Vicente Reig Rincón de Arellano'
|
16
|
-
s.email = 'vicente
|
17
|
-
s.homepage = '
|
16
|
+
s.email = 'vicente@propertybase.com'
|
17
|
+
s.homepage = 'https://github.com/propertybase/virgola'
|
18
18
|
|
19
19
|
s.add_dependency('activesupport', '3.1.3')
|
20
20
|
s.add_dependency('activemodel', '3.1.3')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: virgola
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-02-14 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &70302046764000 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - =
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70302046764000
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activemodel
|
27
|
-
requirement: &
|
27
|
+
requirement: &70302046763500 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - =
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 3.1.3
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70302046763500
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &70302046763000 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,9 +43,9 @@ dependencies:
|
|
43
43
|
version: '1.0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70302046763000
|
47
47
|
description: Virgola is a CSV to Ruby objects mapper.
|
48
|
-
email: vicente
|
48
|
+
email: vicente@propertybase.com
|
49
49
|
executables: []
|
50
50
|
extensions: []
|
51
51
|
extra_rdoc_files: []
|
@@ -55,7 +55,7 @@ files:
|
|
55
55
|
- Gemfile
|
56
56
|
- Gemfile.lock
|
57
57
|
- License
|
58
|
-
- README.
|
58
|
+
- README.textile
|
59
59
|
- Rakefile
|
60
60
|
- lib/virgola.rb
|
61
61
|
- lib/virgola/attribute_methods.rb
|
@@ -68,7 +68,7 @@ files:
|
|
68
68
|
- spec/virgola_callbacks_spec.rb
|
69
69
|
- spec/virgola_spec.rb
|
70
70
|
- virgola.gemspec
|
71
|
-
homepage:
|
71
|
+
homepage: https://github.com/propertybase/virgola
|
72
72
|
licenses: []
|
73
73
|
post_install_message:
|
74
74
|
rdoc_options: []
|