to-csv 1.0.2 → 1.0.3

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.
@@ -1,4 +1,6 @@
1
- sqlite3:
2
- database: ":memory:"
3
- adapter: sqlite3
4
- timeout: 500
1
+ sqlite3:
2
+ database: ":memory:"
3
+ adapter: sqlite3
4
+ timeout: 500
5
+ encoding: utf8
6
+
@@ -0,0 +1,3 @@
1
+ class BlockBuster < ActiveRecord::Base
2
+ has_many :people
3
+ end
@@ -0,0 +1,3 @@
1
+ first:
2
+ id: 1
3
+ address: 1201 Elm Street
@@ -1,7 +1,8 @@
1
- class Movie < ActiveRecord::Base
2
- named_scope :number_of_discs_gte, lambda { |value| { :conditions => ['number_of_discs >= ?', value] } }
3
-
4
- def self.dvd_release_date_lte(date)
5
- scoped :conditions => ["dvd_release_date <= ?", date]
6
- end
7
- end
1
+ class Movie < ActiveRecord::Base
2
+ belongs_to :person, :foreign_key => :cod
3
+ named_scope :number_of_discs_gte, lambda { |value| { :conditions => ['number_of_discs >= ?', value] } }
4
+
5
+ def self.dvd_release_date_lte(date)
6
+ scoped :conditions => ["dvd_release_date <= ?", date]
7
+ end
8
+ end
@@ -1,19 +1,21 @@
1
- the_dark_knight:
2
- id: 1
3
- title: The Dark Knight
4
- subtitles: English, French, Spanish
5
- studio: Warner Home Video
6
- number_of_discs: 2
7
- dvd_release_date: <%= DateTime.new 2008, 12, 9 %>
8
- created_at: <%= Date.new 2009, 12, 12 %>
9
- updated_at: <%= Date.new 2009, 12, 12 %>
10
-
11
- 2001_space_odyssey:
12
- id: 2
13
- title: 2001 - A Space Odyssey
14
- subtitles: English, Spanish, French
15
- studio: Warner Home Video
16
- number_of_discs: 1
17
- dvd_release_date: <%= DateTime.new 2007, 10, 23 %>
18
- created_at: <%= Date.new 2009, 11, 11 %>
19
- updated_at: <%= Date.new 2009, 11, 11 %>
1
+ the_dark_knight:
2
+ id: 1
3
+ title: The Dark Knight
4
+ subtitles: English, French, Spanish
5
+ studio: Warner Home Video
6
+ number_of_discs: 2
7
+ dvd_release_date: "2008-12-08 22:00:00"
8
+ cod: 1
9
+ created_at: <%= Date.new 2009, 12, 12 %>
10
+ updated_at: <%= Date.new 2009, 12, 12 %>
11
+
12
+ 2001_space_odyssey:
13
+ id: 2
14
+ title: 2001 - A Space Odyssey
15
+ subtitles: English, Spanish, French
16
+ studio: Warner Home Video
17
+ number_of_discs: 1
18
+ dvd_release_date: "2007-10-22 21:00:00"
19
+ cod: 2
20
+ created_at: <%= Date.new 2009, 11, 11 %>
21
+ updated_at: <%= Date.new 2009, 11, 11 %>
@@ -1,7 +1,8 @@
1
- icaro:
2
- cod: 1
3
- name: Icaro
4
-
5
- gabriel:
6
- cod: 2
7
- name: Gabriel
1
+ icaro:
2
+ cod: 1
3
+ name: Icaro
4
+ block_buster_id: 1
5
+ gabriel:
6
+ cod: 2
7
+ name: Gabriel
8
+ block_buster_id: 1
@@ -1,3 +1,5 @@
1
- class Person < ActiveRecord::Base
2
- set_primary_key :cod
3
- end
1
+ class Person < ActiveRecord::Base
2
+ has_many :movies, :foreign_key => :cod
3
+ belongs_to :block_buster
4
+ set_primary_key :cod
5
+ end
@@ -1,12 +1,17 @@
1
- ActiveRecord::Schema.define do
2
- create_table :movies, :force => true do |t|
3
- t.string :title, :subtitles, :studio
4
- t.integer :number_of_discs
5
- t.datetime :dvd_release_date
6
- t.timestamps
7
- end
8
-
9
- create_table :people, :primary_key => :cod, :force => true do |t|
10
- t.string :name
11
- end
12
- end
1
+ ActiveRecord::Schema.define do
2
+ create_table :movies, :force => true do |t|
3
+ t.string :title, :subtitles, :studio
4
+ t.integer :number_of_discs, :cod
5
+ t.datetime :dvd_release_date
6
+ t.timestamps
7
+ end
8
+
9
+ create_table :people, :primary_key => :cod, :force => true do |t|
10
+ t.string :name
11
+ t.integer :block_buster_id
12
+ end
13
+
14
+ create_table :block_busters, :force => true do |t|
15
+ t.string :address
16
+ end
17
+ end
@@ -1,20 +1,21 @@
1
- require 'lib/activerecord_test_connector'
2
-
3
- class ActiveRecordTestCase < Test::Unit::TestCase
4
- if defined? ActiveSupport::Testing::SetupAndTeardown
5
- include ActiveSupport::Testing::SetupAndTeardown
6
- end
7
-
8
- if defined? ActiveRecord::TestFixtures
9
- include ActiveRecord::TestFixtures
10
- end
11
-
12
- self.fixture_path = ActiveRecordTestConnector::FIXTURES_PATH
13
- self.use_transactional_fixtures = true
14
-
15
- def self.fixtures(*args)
16
- super
17
- end
18
- end
19
-
20
- ActiveRecordTestConnector.setup
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'activerecord_test_connector'))
2
+
3
+ class ActiveRecordTestCase < Test::Unit::TestCase
4
+ if defined? ActiveSupport::Testing::SetupAndTeardown
5
+ include ActiveSupport::Testing::SetupAndTeardown
6
+ end
7
+
8
+ if defined? ActiveRecord::TestFixtures
9
+ include ActiveRecord::TestFixtures
10
+ end
11
+
12
+ self.fixture_path = ActiveRecordTestConnector::FIXTURES_PATH
13
+ self.use_transactional_fixtures = true
14
+
15
+ def self.fixtures(*args)
16
+ super
17
+ end
18
+ end
19
+
20
+ ActiveRecordTestConnector.setup
21
+
@@ -1,32 +1,34 @@
1
- require 'rubygems'
2
- require 'active_record'
3
- require 'active_record/fixtures'
4
-
5
- class ActiveRecordTestConnector
6
- FIXTURES_PATH = File.join(File.dirname(__FILE__), '..', 'fixtures')
7
-
8
- def self.setup
9
- setup_connection
10
- load_schema
11
- add_load_path FIXTURES_PATH
12
- end
13
-
14
- private
15
-
16
- def self.add_load_path(path)
17
- dep = defined?(ActiveSupport::Dependencies) ? ActiveSupport::Dependencies : ::Dependencies
18
- dep.load_paths.unshift path
19
- end
20
-
21
- def self.load_schema
22
- ActiveRecord::Base.silence do
23
- ActiveRecord::Migration.verbose = false
24
- load File.join(FIXTURES_PATH, 'schema.rb')
25
- end
26
- end
27
-
28
- def self.setup_connection
29
- configurations = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'database.yml'))
30
- ActiveRecord::Base.establish_connection configurations['sqlite3']
31
- end
32
- end
1
+ require 'rubygems'
2
+ gem 'activerecord', '2.3.5'
3
+ require 'active_record'
4
+ require 'active_record/fixtures'
5
+
6
+ class ActiveRecordTestConnector
7
+ FIXTURES_PATH = File.join(File.dirname(__FILE__), '..', 'fixtures')
8
+
9
+ def self.setup
10
+ setup_connection
11
+ load_schema
12
+ add_load_path FIXTURES_PATH
13
+ end
14
+
15
+ private
16
+
17
+ def self.add_load_path(path)
18
+ dep = defined?(ActiveSupport::Dependencies) ? ActiveSupport::Dependencies : ::Dependencies
19
+ dep.load_paths.unshift path
20
+ end
21
+
22
+ def self.load_schema
23
+ ActiveRecord::Base.silence do
24
+ ActiveRecord::Migration.verbose = false
25
+ load File.join(FIXTURES_PATH, 'schema.rb')
26
+ end
27
+ end
28
+
29
+ def self.setup_connection
30
+ configurations = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'database.yml'))
31
+ ActiveRecord::Base.establish_connection configurations['sqlite3']
32
+ end
33
+ end
34
+
@@ -1,9 +1,10 @@
1
- require 'lib/activerecord_test_connector'
2
-
3
- # setup the connection
4
- ActiveRecordTestConnector.setup
5
-
6
- # load all fixtures
7
- Fixtures.create_fixtures(ActiveRecordTestConnector::FIXTURES_PATH, ActiveRecord::Base.connection.tables)
8
-
9
- require 'to_csv'
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'activerecord_test_connector'))
2
+
3
+ # setup the connection
4
+ ActiveRecordTestConnector.setup
5
+
6
+ # load all fixtures
7
+ Fixtures.create_fixtures(ActiveRecordTestConnector::FIXTURES_PATH, ActiveRecord::Base.connection.tables)
8
+
9
+ require 'to_csv'
10
+
@@ -1,28 +1,28 @@
1
- "en-US":
2
- date:
3
- formats:
4
- default: "%Y-%m-%d"
5
- short: "%e %b"
6
- long: "%B %e, %Y"
7
- only_day: "%e"
8
-
9
- day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday]
10
- abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat]
11
- month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December]
12
- abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec]
13
- order: [ :year, :month, :day ]
14
-
15
- time:
16
- formats:
17
- default: "%a %b %d %H:%M:%S %Z %Y"
18
- time: "%H:%M"
19
- short: "%d %b %H:%M"
20
- long: "%B %d, %Y %H:%M"
21
- only_second: "%S"
22
-
23
- datetime:
24
- formats:
25
- default: "%Y-%m-%dT%H:%M:%S%Z"
26
-
27
- am: 'am'
1
+ "en-US":
2
+ date:
3
+ formats:
4
+ default: "%Y-%m-%d"
5
+ short: "%e %b"
6
+ long: "%B %e, %Y"
7
+ only_day: "%e"
8
+
9
+ day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday]
10
+ abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat]
11
+ month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December]
12
+ abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec]
13
+ order: [ :year, :month, :day ]
14
+
15
+ time:
16
+ formats:
17
+ default: "%a %b %d %H:%M:%S %Z %Y"
18
+ time: "%H:%M"
19
+ short: "%d %b %H:%M"
20
+ long: "%B %d, %Y %H:%M"
21
+ only_second: "%S"
22
+
23
+ datetime:
24
+ formats:
25
+ default: "%Y-%m-%dT%H:%M:%S%Z"
26
+
27
+ am: 'am'
28
28
  pm: 'pm'
@@ -1,147 +1,147 @@
1
- # formatos de data e hora
2
- date:
3
- formats:
4
- default: "%d/%m/%Y"
5
- short: "%d de %B"
6
- long: "%d de %B de %Y"
7
-
8
- day_names: [Domingo, Segunda, Terça, Quarta, Quinta, Sexta, Sábado]
9
- abbr_day_names: [Dom, Seg, Ter, Qua, Qui, Sex, Sáb]
10
- month_names: [~, Janeiro, Fevereiro, Março, Abril, Maio, Junho, Julho, Agosto, Setembro, Outubro, Novembro, Dezembro]
11
- abbr_month_names: [~, Jan, Fev, Mar, Abr, Mai, Jun, Jul, Ago, Set, Out, Nov, Dez]
12
- order: [ :day, :month, :year ]
13
-
14
- time:
15
- formats:
16
- default: "%A, %d de %B de %Y, %H:%M h"
17
- short: "%d/%m, %H:%M h"
18
- long: "%A, %d de %B de %Y, %H:%M h"
19
- am: ''
20
- pm: ''
21
-
22
- # date helper distanci em palavras
23
- datetime:
24
- distance_in_words:
25
- half_a_minute: 'meio minuto'
26
- less_than_x_seconds:
27
- one: 'menos de 1 segundo'
28
- other: 'menos de {{count}} segundos'
29
-
30
- x_seconds:
31
- one: '1 segundo'
32
- other: '{{count}} segundos'
33
-
34
- less_than_x_minutes:
35
- one: 'menos de um minuto'
36
- other: 'menos de {{count}} minutos'
37
-
38
- x_minutes:
39
- one: '1 minuto'
40
- other: '{{count}} minutos'
41
-
42
- about_x_hours:
43
- one: 'aproximadamente 1 hora'
44
- other: 'aproximadamente {{count}} horas'
45
-
46
- x_days:
47
- one: '1 dia'
48
- other: '{{count}} dias'
49
-
50
- about_x_months:
51
- one: 'aproximadamente 1 mês'
52
- other: 'aproximadamente {{count}} meses'
53
-
54
- x_months:
55
- one: '1 mês'
56
- other: '{{count}} meses'
57
-
58
- about_x_years:
59
- one: 'aproximadamente 1 ano'
60
- other: 'aproximadamente {{count}} anos'
61
-
62
- over_x_years:
63
- one: 'mais de 1 ano'
64
- other: 'mais de {{count}} anos'
65
- prompts:
66
- year: "Ano"
67
- month: "Mês"
68
- day: "Dia"
69
- hour: "Hora"
70
- minute: "Minuto"
71
- second: "Segundos"
72
-
73
- # numeros
74
- number:
75
- format:
76
- precision: 3
77
- separator: ','
78
- delimiter: '.'
79
- currency:
80
- format:
81
- unit: 'R$'
82
- precision: 2
83
- format: '%u %n'
84
- separator: ','
85
- delimiter: '.'
86
- percentage:
87
- format:
88
- delimiter: '.'
89
- precision:
90
- format:
91
- delimiter: '.'
92
- human:
93
- format:
94
- precision: 1
95
- delimiter: '.'
96
- storage_units:
97
- format: "%n %u"
98
- units:
99
- byte:
100
- one: "Byte"
101
- other: "Bytes"
102
- kb: "KB"
103
- mb: "MB"
104
- gb: "GB"
105
- tb: "TB"
106
-
107
- # Used in array.to_sentence.
108
- support:
109
- array:
110
- words_connector: ", "
111
- two_words_connector: " e "
112
- last_word_connector: " e "
113
-
114
- # Active Record
115
- activerecord:
116
- errors:
117
- template:
118
- header:
119
- one: "Não foi possível gravar {{model}}: 1 erro"
120
- other: "Não foi possível gravar {{model}}: {{count}} erros."
121
- body: "Por favor, verifique o(s) seguinte(s) campo(s):"
122
- messages:
123
- inclusion: "não está incluído na lista"
124
- exclusion: "não está disponível"
125
- invalid: "não é válido"
126
- confirmation: "não está de acordo com a confirmação"
127
- accepted: "deve ser aceito"
128
- empty: "não pode ficar vazio"
129
- blank: "não pode ficar em branco"
130
- too_long: "é muito longo (máximo: {{count}} caracteres)"
131
- too_short: "é muito curto (mínimo: {{count}} caracteres)"
132
- wrong_length: "não possui o tamanho esperado ({{count}} caracteres)"
133
- taken: "já está em uso"
134
- not_a_number: "não é um número"
135
- greater_than: "deve ser maior do que {{count}}"
136
- greater_than_or_equal_to: "deve ser maior ou igual a {{count}}"
137
- equal_to: "deve ser igual a {{count}}"
138
- less_than: "deve ser menor do que {{count}}"
139
- less_than_or_equal_to: "deve ser menor ou igual a {{count}}"
140
- odd: "deve ser ímpar"
141
- even: "deve ser par"
142
- attributes:
143
- movie:
144
- title: Título
145
- subtitles: Legendas
146
- number_of_discs: Número de Discos
147
- dvd_release_date: Data de Lançamento do DVD
1
+ # formatos de data e hora
2
+ date:
3
+ formats:
4
+ default: "%d/%m/%Y"
5
+ short: "%d de %B"
6
+ long: "%d de %B de %Y"
7
+
8
+ day_names: [Domingo, Segunda, Terça, Quarta, Quinta, Sexta, Sábado]
9
+ abbr_day_names: [Dom, Seg, Ter, Qua, Qui, Sex, Sáb]
10
+ month_names: [~, Janeiro, Fevereiro, Março, Abril, Maio, Junho, Julho, Agosto, Setembro, Outubro, Novembro, Dezembro]
11
+ abbr_month_names: [~, Jan, Fev, Mar, Abr, Mai, Jun, Jul, Ago, Set, Out, Nov, Dez]
12
+ order: [ :day, :month, :year ]
13
+
14
+ time:
15
+ formats:
16
+ default: "%A, %d de %B de %Y, %H:%M h"
17
+ short: "%d/%m, %H:%M h"
18
+ long: "%A, %d de %B de %Y, %H:%M h"
19
+ am: ''
20
+ pm: ''
21
+
22
+ # date helper distanci em palavras
23
+ datetime:
24
+ distance_in_words:
25
+ half_a_minute: 'meio minuto'
26
+ less_than_x_seconds:
27
+ one: 'menos de 1 segundo'
28
+ other: 'menos de {{count}} segundos'
29
+
30
+ x_seconds:
31
+ one: '1 segundo'
32
+ other: '{{count}} segundos'
33
+
34
+ less_than_x_minutes:
35
+ one: 'menos de um minuto'
36
+ other: 'menos de {{count}} minutos'
37
+
38
+ x_minutes:
39
+ one: '1 minuto'
40
+ other: '{{count}} minutos'
41
+
42
+ about_x_hours:
43
+ one: 'aproximadamente 1 hora'
44
+ other: 'aproximadamente {{count}} horas'
45
+
46
+ x_days:
47
+ one: '1 dia'
48
+ other: '{{count}} dias'
49
+
50
+ about_x_months:
51
+ one: 'aproximadamente 1 mês'
52
+ other: 'aproximadamente {{count}} meses'
53
+
54
+ x_months:
55
+ one: '1 mês'
56
+ other: '{{count}} meses'
57
+
58
+ about_x_years:
59
+ one: 'aproximadamente 1 ano'
60
+ other: 'aproximadamente {{count}} anos'
61
+
62
+ over_x_years:
63
+ one: 'mais de 1 ano'
64
+ other: 'mais de {{count}} anos'
65
+ prompts:
66
+ year: "Ano"
67
+ month: "Mês"
68
+ day: "Dia"
69
+ hour: "Hora"
70
+ minute: "Minuto"
71
+ second: "Segundos"
72
+
73
+ # numeros
74
+ number:
75
+ format:
76
+ precision: 3
77
+ separator: ','
78
+ delimiter: '.'
79
+ currency:
80
+ format:
81
+ unit: 'R$'
82
+ precision: 2
83
+ format: '%u %n'
84
+ separator: ','
85
+ delimiter: '.'
86
+ percentage:
87
+ format:
88
+ delimiter: '.'
89
+ precision:
90
+ format:
91
+ delimiter: '.'
92
+ human:
93
+ format:
94
+ precision: 1
95
+ delimiter: '.'
96
+ storage_units:
97
+ format: "%n %u"
98
+ units:
99
+ byte:
100
+ one: "Byte"
101
+ other: "Bytes"
102
+ kb: "KB"
103
+ mb: "MB"
104
+ gb: "GB"
105
+ tb: "TB"
106
+
107
+ # Used in array.to_sentence.
108
+ support:
109
+ array:
110
+ words_connector: ", "
111
+ two_words_connector: " e "
112
+ last_word_connector: " e "
113
+
114
+ # Active Record
115
+ activerecord:
116
+ errors:
117
+ template:
118
+ header:
119
+ one: "Não foi possível gravar {{model}}: 1 erro"
120
+ other: "Não foi possível gravar {{model}}: {{count}} erros."
121
+ body: "Por favor, verifique o(s) seguinte(s) campo(s):"
122
+ messages:
123
+ inclusion: "não está incluído na lista"
124
+ exclusion: "não está disponível"
125
+ invalid: "não é válido"
126
+ confirmation: "não está de acordo com a confirmação"
127
+ accepted: "deve ser aceito"
128
+ empty: "não pode ficar vazio"
129
+ blank: "não pode ficar em branco"
130
+ too_long: "é muito longo (máximo: {{count}} caracteres)"
131
+ too_short: "é muito curto (mínimo: {{count}} caracteres)"
132
+ wrong_length: "não possui o tamanho esperado ({{count}} caracteres)"
133
+ taken: "já está em uso"
134
+ not_a_number: "não é um número"
135
+ greater_than: "deve ser maior do que {{count}}"
136
+ greater_than_or_equal_to: "deve ser maior ou igual a {{count}}"
137
+ equal_to: "deve ser igual a {{count}}"
138
+ less_than: "deve ser menor do que {{count}}"
139
+ less_than_or_equal_to: "deve ser menor ou igual a {{count}}"
140
+ odd: "deve ser ímpar"
141
+ even: "deve ser par"
142
+ attributes:
143
+ movie:
144
+ title: Título
145
+ subtitles: Legendas
146
+ number_of_discs: Número de Discos
147
+ dvd_release_date: Data de Lançamento do DVD