Browse files

tests now pass.

  • Loading branch information...
1 parent 4105d1b commit 84a6a0e120fc29193577fa213b832199354c389b @stefanpenner committed Mar 7, 2012
Showing with 7 additions and 21 deletions.
  1. +6 −5 lib/to_csv.rb
  2. +0 −15 spec/spec_helper.rb
  3. +1 −1 spec/to_csv_spec.rb
View
11 lib/to_csv.rb
@@ -1,12 +1,13 @@
require 'active_support/concern'
-#require 'active_support/core_ext/class/inheritable_attributes'
-require 'fastercsv' unless RUBY_VERSION >= "1.9"
+require 'active_support/core_ext/class/attribute'
+require 'csv'
+require 'to_csv/version'
require 'to_csv/interceptor'
module ToCsv
extend ActiveSupport::Concern
- included do
+ included do
class_attribute :csv_instructions
self.csv_instructions = Hash.new({})
end
@@ -19,13 +20,13 @@ def csv(namespace=:default,&block)
def to_csv(namespace = :default)
Interceptor.from(self).to_block(&csv_instructions[namespace]).with_result do |results,methods|
- FasterCSV::generate_line(results)
+ CSV::generate_line(results)
end
end
def to_csv_header(namespace = :default)
Interceptor.from(self).to_block(&csv_instructions[namespace]).with_result do |results,methods|
- FasterCSV::generate_line(methods)
+ CSV::generate_line(methods)
end
end
end
View
15 spec/spec_helper.rb
@@ -1,15 +0,0 @@
-$LOAD_PATH.unshift(File.dirname(__FILE__))
-$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
-
-require 'rubygems'
-require 'bundler'
-
-Bundler.setup
-
-require 'to_csv'
-require 'spec'
-require 'spec/autorun'
-
-Spec::Runner.configure do |config|
-
-end
View
2 spec/to_csv_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
+require './lib/to_csv'
class Email
include ToCsv

0 comments on commit 84a6a0e

Please sign in to comment.