Permalink
Browse files

rename to-csv-rails to to_csv-rails

  • Loading branch information...
1 parent 460d356 commit 08f0e2bdbcc6ee047fe2222a88b0b7821525d2de wenke committed Mar 20, 2011
Showing with 7 additions and 50 deletions.
  1. +4 −4 README.rdoc
  2. +1 −1 Rakefile
  3. +1 −1 VERSION
  4. +1 −1 init.rb
  5. +0 −24 lib/to_csv.rb
  6. +0 −19 to_csv.gemspec
View
@@ -1,4 +1,4 @@
-== to-csv-rails
+== to_csv on Rails
This simple plugin gives you the ability to call to_csv to a collection of activerecords. The builder options are the same as to_json / to_xml, except for the :include.
@@ -36,13 +36,13 @@ This simple plugin gives you the ability to call to_csv to a collection of activ
== Install
- git clone http://github.com/wenke/to-csv-rails.git OR
+ git clone http://github.com/wenke/to_csv-rails.git OR
on rails 2.x.x
- ./script/plugin install git://github.com/wenke/to-csv-rails.git
+ ./script/plugin install git://github.com/wenke/to_csv-rails.git
on rails 3
- rails plugin install git://github.com/wenke/to-csv-rails.git
+ rails plugin install git://github.com/wenke/to_csv-rails.git
== Note
View
@@ -6,7 +6,7 @@ require 'rake/gempackagetask'
desc 'Default: run unit tests.'
task :default => :test
-desc 'Test the to-csv-rails plugin.'
+desc 'Test the to_csv-rails plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
View
@@ -1 +1 @@
-1.0.0
+0.1.0
View
@@ -1 +1 @@
-require 'to_csv'
+require 'to_csv-rails'
View
@@ -1,24 +0,0 @@
-class Array
-
- def to_csv(options = {})
- return '' if self.empty?
-
- #columns = self.first.class.content_columns # not include the ID column
- if options[:only]
- columns = Array(options[:only]).map(&:to_sym)
- else
- columns = self.first.class.column_names.map(&:to_sym) - Array(options[:except]).map(&:to_sym)
- end
-
- return '' if columns.empty?
-
- data = []
- # header
- data << columns.map(&:to_s).map(&:humanize).join(', ') unless options[:header] == false
- self.each do |obj|
- data << columns.map{ |column| obj.send(column) }.join(', ')
- end
- data.join("\n")
- end
-
-end
View
@@ -1,19 +0,0 @@
-# encoding: utf-8
-
-version = File.read(File.expand_path("../VERSION",__FILE__)).strip
-
-Gem::Specification.new do |s|
- s.name = 'to-csv-rails'
- s.version = version
- s.author = "LiangWenKe"
- s.email = "liangwenke8@gmail.com"
- s.homepage = "http://github.com/wenke/to-csv-rails"
- s.summary = "Export data to csv on Rails"
- s.description = "This simple plugin gives you the ability to call to_csv to a collection of activerecords. The builder options are the same as to_json / to_xml, except for the :include."
-
- s.files = Dir["lib/**/*", "[a-zA-Z]*", "init.rb"] - ["Gemfile.lock"]
- s.require_path = "lib"
-
- s.rubyforge_project = s.name
- s.required_rubygems_version = ">= 1.3.4"
-end

0 comments on commit 08f0e2b

Please sign in to comment.