Fixed Width Structures
Similar Projects: YAML Model, to_xml, Remarkably
Installation
gem install fixed-width-structures
Usage
require 'fixed-width-structures' class RowData < FixedWidthStructure alphabetic :name, 29 filler 1, '-' numeric :age, 3 alphabetic :active, 1, 'Y' space 6 numeric :account_number, 13 filler 2 end clive = RowData.new clive.name = "Clive Crous" clive.age = 37 clive.account_number = 12345 bob = RowData.new bob.name = "Bob" bob.age = 29 bob.active = 'N' bob.account_number = 678934543 p clive p bob # => "Clive Crous -037Y 0000000012345XX" # => "Bob -029N 0000678934543XX"
Source Code
GitHub
git clone git://github.com/clivecrous/fixed-width-structures
cd fixed-width-structures
View all Libraries
git clone git://github.com/clivecrous/fixed-width-structures
cd fixed-width-structures
View all Libraries