rapid_transit 0.0.4 → 0.0.5

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.
@@ -3,7 +3,8 @@ class RapidTransit::Base
3
3
  # Define singleton for class variables whose values will not be inherited by
4
4
  # subclasses of RapidTransit::Base
5
5
  class << self
6
- attr_accessor :delimiter, :strip, :column_names, :actions, :error_handler
6
+ attr_accessor :delimiter, :strip, :column_names, :actions, :error_handler,
7
+ :print_status
7
8
  end
8
9
 
9
10
  # Set the delimiter used in the file
@@ -15,6 +16,11 @@ class RapidTransit::Base
15
16
  @delimiter ||= ","
16
17
  end
17
18
 
19
+ def self.print_status
20
+ @print_status ||= Proc.new { !Rails.env.test? }
21
+ @print_status.is_a?(Proc) ? @print_status.call : @print_status
22
+ end
23
+
18
24
  # Set whether to strip whitespace from column values
19
25
  def self.strip_columns(strip_val)
20
26
  @strip = strip_val
@@ -99,12 +105,16 @@ class RapidTransit::Base
99
105
  rescue => e
100
106
  error_handler.call e, row
101
107
  end
102
- print "#{reset}Parsed #{count} of #{total} records"
103
- STDOUT.flush
108
+ if print_status
109
+ print "#{reset}Parsed #{count} of #{total} records"
110
+ STDOUT.flush
111
+ end
104
112
  end
105
113
  after_parse
106
- print reset
107
- STDOUT.flush
114
+ if print_status
115
+ print reset
116
+ STDOUT.flush
117
+ end
108
118
  count
109
119
  end
110
120
 
@@ -1,3 +1,3 @@
1
1
  module RapidTransit
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jay McAliley
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-03-21 00:00:00 -04:00
17
+ date: 2012-05-15 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency