7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/datafy.rb', line 7
def self.usage
puts "\nHello there.\nDatafy.usage here to help you persist Ruby attributes as data Fields; and store the data in CSV files.\n"
puts "The basic idea is simple: for each class whose instances you want to represent as data & save into a CSV file, you: "
puts "\t - establish class constants that identify the object attributes to dayafy, there are commonly two constants:"
puts "\t\t 1) KEY_FIELDS - establish the key fields for each object"
puts "\t\t 2) PROPERTY_FIELDS - establish the other )non-key) fields for each object"
puts "\t - register the property attributes with the class, via \"prop_accessor PROPERTY_FIELDS\""
my_loc = File.dirname(__FILE__)
proto_src = File.join(my_loc, 'resources/Proto.rb')
proto_exists = File.exists? proto_src
if proto_exists
puts "\nHere's an example of a prototype class employing datafy:"
puts "--------------------------------------------------------"
contents = File.read(proto_src)
puts contents
puts "--------------------------------------------------------"
end
end
|