csvify 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (8) hide show
  1. data/CHANGELOG +0 -0
  2. data/Manifest +6 -0
  3. data/README.rdoc +11 -0
  4. data/Rakefile +14 -0
  5. data/csvify.gemspec +30 -0
  6. data/init.rb +1 -0
  7. data/lib/csvify.rb +19 -0
  8. metadata +68 -0
data/CHANGELOG ADDED
File without changes
data/Manifest ADDED
@@ -0,0 +1,6 @@
1
+ CHANGELOG
2
+ Manifest
3
+ README.rdoc
4
+ Rakefile
5
+ init.rb
6
+ lib/csvify.rb
data/README.rdoc ADDED
@@ -0,0 +1,11 @@
1
+ = csvify
2
+
3
+ Rails gem for adding a to_csv (similar to to_xml method) method to Array class for Active Record results.
4
+
5
+ Usage:
6
+
7
+ @records = Record.all
8
+
9
+ @records.to_csv
10
+
11
+ Copyright 2009 Eli Mayost, released under the MIT license
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('csvify', '0.1.0') do |p|
6
+ p.description = "Add a to_csv (similar to to_xml method) method to Array class for Active Record results"
7
+ p.url = "http://github.com/elimayost/csvify"
8
+ p.author = "Eli Mayost"
9
+ p.email = "eli.mayost@googlemail.com"
10
+ p.ignore_pattern = ["tmp/*", "script/*"]
11
+ p.development_dependencies = []
12
+ end
13
+
14
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
data/csvify.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{csvify}
5
+ s.version = "0.1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Eli Mayost"]
9
+ s.date = %q{2010-01-21}
10
+ s.description = %q{Add a to_csv (similar to to_xml method) method to Array class for Active Record results}
11
+ s.email = %q{eli.mayost@googlemail.com}
12
+ s.extra_rdoc_files = ["CHANGELOG", "README.rdoc", "lib/csvify.rb"]
13
+ s.files = ["CHANGELOG", "Manifest", "README.rdoc", "Rakefile", "init.rb", "lib/csvify.rb", "csvify.gemspec"]
14
+ s.homepage = %q{http://github.com/elimayost/csvify}
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Csvify", "--main", "README.rdoc"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{csvify}
18
+ s.rubygems_version = %q{1.3.5}
19
+ s.summary = %q{Add a to_csv (similar to to_xml method) method to Array class for Active Record results}
20
+
21
+ if s.respond_to? :specification_version then
22
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
23
+ s.specification_version = 3
24
+
25
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
26
+ else
27
+ end
28
+ else
29
+ end
30
+ end
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'csvify'
data/lib/csvify.rb ADDED
@@ -0,0 +1,19 @@
1
+ class Array
2
+
3
+ def to_csv
4
+ columns = self.first.class.column_names
5
+ data = ""
6
+ self.each do |o|
7
+ columns.each_with_index do |c, i|
8
+ if i < columns.length-1
9
+ data << "'#{o.send(c.to_s).to_s.strip}', "
10
+ else
11
+ data << "'#{o.send(c.to_s).to_s.strip}'"
12
+ end
13
+ end
14
+ data << "\n"
15
+ end
16
+ return data
17
+ end
18
+
19
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: csvify
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Eli Mayost
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-21 00:00:00 +00:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Add a to_csv (similar to to_xml method) method to Array class for Active Record results
17
+ email: eli.mayost@googlemail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - CHANGELOG
24
+ - README.rdoc
25
+ - lib/csvify.rb
26
+ files:
27
+ - CHANGELOG
28
+ - Manifest
29
+ - README.rdoc
30
+ - Rakefile
31
+ - init.rb
32
+ - lib/csvify.rb
33
+ - csvify.gemspec
34
+ has_rdoc: true
35
+ homepage: http://github.com/elimayost/csvify
36
+ licenses: []
37
+
38
+ post_install_message:
39
+ rdoc_options:
40
+ - --line-numbers
41
+ - --inline-source
42
+ - --title
43
+ - Csvify
44
+ - --main
45
+ - README.rdoc
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: "1.2"
59
+ version:
60
+ requirements: []
61
+
62
+ rubyforge_project: csvify
63
+ rubygems_version: 1.3.5
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: Add a to_csv (similar to to_xml method) method to Array class for Active Record results
67
+ test_files: []
68
+