flat_filer 0.0.17 → 0.0.18
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.
- data/lib/flat_file.rb +5 -2
- metadata +6 -4
data/lib/flat_file.rb
CHANGED
|
@@ -127,7 +127,8 @@ class FlatFile
|
|
|
127
127
|
attr :padding, true
|
|
128
128
|
attr :map_in_proc, true
|
|
129
129
|
attr :aggressive, true
|
|
130
|
-
|
|
130
|
+
attr :default, true
|
|
131
|
+
|
|
131
132
|
# Create a new FeildDef, having name and width. klass is a reference to the FlatFile
|
|
132
133
|
# subclass that contains this field definition. This reference is needed when calling
|
|
133
134
|
# filters if they are specified using a symbol.
|
|
@@ -142,7 +143,8 @@ class FlatFile
|
|
|
142
143
|
@formatters = Array.new
|
|
143
144
|
@file_klass = klass
|
|
144
145
|
@padding = options.delete(:padding)
|
|
145
|
-
|
|
146
|
+
@default = options.has_key?(:default) ? options.delete(:default) : ""
|
|
147
|
+
|
|
146
148
|
add_filter(options[:filter]) if options.has_key?(:filter)
|
|
147
149
|
add_formatter(options[:formatter]) if options.has_key?(:formatter)
|
|
148
150
|
@map_in_proc = options[:map_in_proc]
|
|
@@ -264,6 +266,7 @@ class FlatFile
|
|
|
264
266
|
f.map_in_proc.call(model,self)
|
|
265
267
|
else
|
|
266
268
|
model.send("#{f.name}=", send(f.name)) if f.aggressive or model.send(f.name).blank?
|
|
269
|
+
model.send("#{f.name}=", f.default) if model.send(f.name).blank?
|
|
267
270
|
end
|
|
268
271
|
end
|
|
269
272
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: flat_filer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.18
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Libby
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date:
|
|
12
|
+
date: 2009-09-25 00:00:00 -04:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies: []
|
|
15
15
|
|
|
@@ -26,6 +26,8 @@ files:
|
|
|
26
26
|
- lib/flat_file.rb
|
|
27
27
|
has_rdoc: true
|
|
28
28
|
homepage: http://www.tangeis.com/
|
|
29
|
+
licenses: []
|
|
30
|
+
|
|
29
31
|
post_install_message:
|
|
30
32
|
rdoc_options: []
|
|
31
33
|
|
|
@@ -46,9 +48,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
46
48
|
requirements: []
|
|
47
49
|
|
|
48
50
|
rubyforge_project:
|
|
49
|
-
rubygems_version: 1.
|
|
51
|
+
rubygems_version: 1.3.5
|
|
50
52
|
signing_key:
|
|
51
|
-
specification_version:
|
|
53
|
+
specification_version: 3
|
|
52
54
|
summary: Library for processing flat files
|
|
53
55
|
test_files: []
|
|
54
56
|
|