danmunk-fixed_fields 0.1.0

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/Manifest ADDED
@@ -0,0 +1,5 @@
1
+ init.rb
2
+ lib/fixed_fields.rb
3
+ Manifest
4
+ Rakefile
5
+ README.rdoc
data/README.rdoc ADDED
@@ -0,0 +1,37 @@
1
+ = Fixed Fields
2
+
3
+ Rails gem for mapping fixed length field records to an Active Record instance.
4
+
5
+ == Install
6
+
7
+ == Usage
8
+
9
+ class User < ActiveRecord::Base
10
+ fixed_field 'first_name', :begin => 0, :width => 12
11
+ fixed_field 'last_name', :begin => 12, :end => 24
12
+ end
13
+
14
+
15
+ new_user = User.read_fields(fixed_length_record)
16
+ == License
17
+
18
+ Copyright (c) 2008 Dan Munk
19
+
20
+ Permission is hereby granted, free of charge, to any person obtaining
21
+ a copy of this software and associated documentation files (the
22
+ "Software"), to deal in the Software without restriction, including
23
+ without limitation the rights to use, copy, modify, merge, publish,
24
+ distribute, sublicense, and/or sell copies of the Software, and to
25
+ permit persons to whom the Software is furnished to do so, subject to
26
+ the following conditions:
27
+
28
+ The above copyright notice and this permission notice shall be
29
+ included in all copies or substantial portions of the Software.
30
+
31
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
34
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
35
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
36
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
37
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('fixed_fields', '0.1.0') do |f|
6
+ f.description = 'Helps map fields from fixed length record to an active record instance'
7
+ f.url = 'http://www.github.com/danmunk/fixed_fields'
8
+ f.author = 'Dan Munk'
9
+ f.email = 'danmunk@gmail.com'
10
+ f.ignore_pattern = ['tmp/*', 'script/*']
11
+ f.development_dependencies = []
12
+ end
13
+
14
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
15
+
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{fixed_fields}
5
+ s.version = "0.1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Dan Munk"]
9
+ s.date = %q{2008-12-26}
10
+ s.description = %q{Helps map fields from fixed length record to an active record instance}
11
+ s.email = %q{danmunk@gmail.com}
12
+ s.extra_rdoc_files = ["lib/fixed_fields.rb", "README.rdoc"]
13
+ s.files = ["init.rb", "lib/fixed_fields.rb", "Manifest", "Rakefile", "README.rdoc", "fixed_fields.gemspec"]
14
+ s.has_rdoc = true
15
+ s.homepage = %q{http://www.github.com/danmunk/fixed_fields}
16
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Fixed_fields", "--main", "README.rdoc"]
17
+ s.require_paths = ["lib"]
18
+ s.rubyforge_project = %q{fixed_fields}
19
+ s.rubygems_version = %q{1.3.1}
20
+ s.summary = %q{Helps map fields from fixed length record to an active record instance}
21
+
22
+ if s.respond_to? :specification_version then
23
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
+ s.specification_version = 2
25
+
26
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
27
+ else
28
+ end
29
+ else
30
+ end
31
+ end
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'fixed_fields'
@@ -0,0 +1,25 @@
1
+ module Fixedfields
2
+
3
+ def self.included(base)
4
+ base.extend FieldMethods
5
+ end
6
+
7
+ module FieldMethods
8
+ def fixed_fields(attribute, options={})
9
+ unless included_modules.include? InstanceMethods
10
+ extend ClassMethods
11
+ include InstanceMethods
12
+ end
13
+ end
14
+ end
15
+
16
+ module ClassMethods
17
+
18
+ end
19
+
20
+ module InstanceMethods
21
+
22
+ end
23
+ end
24
+
25
+ ActiveRecord::Base.send(:include, FixedFields)
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: danmunk-fixed_fields
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Dan Munk
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-12-26 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Helps map fields from fixed length record to an active record instance
17
+ email: danmunk@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - lib/fixed_fields.rb
24
+ - README.rdoc
25
+ files:
26
+ - init.rb
27
+ - lib/fixed_fields.rb
28
+ - Manifest
29
+ - Rakefile
30
+ - README.rdoc
31
+ - fixed_fields.gemspec
32
+ has_rdoc: true
33
+ homepage: http://www.github.com/danmunk/fixed_fields
34
+ post_install_message:
35
+ rdoc_options:
36
+ - --line-numbers
37
+ - --inline-source
38
+ - --title
39
+ - Fixed_fields
40
+ - --main
41
+ - README.rdoc
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: "0"
49
+ version:
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: "1.2"
55
+ version:
56
+ requirements: []
57
+
58
+ rubyforge_project: fixed_fields
59
+ rubygems_version: 1.2.0
60
+ signing_key:
61
+ specification_version: 2
62
+ summary: Helps map fields from fixed length record to an active record instance
63
+ test_files: []
64
+