loady 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -2,40 +2,40 @@
2
2
 
3
3
  Loady is a simple file reader and logger. Use it to quickly load a csv file, continue on error rows, and do basic logging.
4
4
 
5
- Currently it only works with ruby 1.9.
5
+ It works with ruby 1.9.
6
6
 
7
7
  == Install
8
8
 
9
9
  gem install loady
10
10
 
11
- Use bunder. Include the gem in your Gemfile:
11
+ Use bundler. Include the gem in your Gemfile:
12
12
 
13
13
  gem 'loady'
14
14
 
15
15
  == Use
16
16
 
17
- If any error occurs, Loady will continue reading the file, ignoring problems rows and logging a warning for each.
17
+ If an error occurs, Loady will continue reading the file, ignoring problems rows and logging a warning for each.
18
18
 
19
19
  By default, messages are logged to the standard output.
20
20
 
21
21
  Basic usage:
22
22
 
23
- Loady::CsvLoader.read "/your/file.csv" do |row|
23
+ Loady.csv "/your/file.csv" do |row|
24
24
  # your code to process each row goes here
25
25
  puts "#{row[0]}, #{row[1]}, etc."
26
26
  end
27
27
 
28
- Skip first row and log to a file:
28
+ Skip the first row and log to a file:
29
29
 
30
30
  logger = Logger.new "/your/file.log"
31
31
 
32
- Loady::CsvLoader.read "/your/file.csv", :logger => logger, :skip_first_row => true do |row|
32
+ Loady.csv "/your/file.csv", :logger => logger, :skip_first_row => true do |row|
33
33
  # do some stuff for each row
34
34
  end
35
35
 
36
36
  Name your attributes:
37
37
 
38
- Loady::CsvLoader.read "/your/file.csv" do |row|
38
+ Loady.csv "/your/file.csv" do |row|
39
39
  Monkey.create row.to_attributes [:name, :year, :mom]
40
40
  end
41
41
 
data/lib/loady.rb CHANGED
@@ -1,2 +1,9 @@
1
1
  require 'loady/array'
2
2
  require 'loady/csv_loader'
3
+
4
+ module Loady
5
+ def csv(*args, &block)
6
+ Loady::CsvLoader.read(*args, &block)
7
+ end
8
+ module_function :csv
9
+ end
data/lib/loady/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Loady
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/loady.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Tee Parham"]
10
10
  s.email = ["tee@stackpilot.com"]
11
- s.homepage = ""
11
+ s.homepage = "http://github.com/stackpilot/loady"
12
12
  s.summary = %q{CSV file loader with simple logging}
13
13
  s.description = %q{CSV file loader with simple logging}
14
14
 
@@ -22,7 +22,7 @@ class CsvLoaderTest < Test::Unit::TestCase
22
22
  logger = Logger.new("/dev/null")
23
23
  monkeys = []
24
24
 
25
- Loady::CsvLoader.read "test/csv/file2.csv", :logger => logger do |row|
25
+ Loady.csv "test/csv/file2.csv", :logger => logger do |row|
26
26
  monkeys << row.to_attributes([:name, :year])
27
27
  end
28
28
 
@@ -32,7 +32,7 @@ class CsvLoaderTest < Test::Unit::TestCase
32
32
  assert_equal monkeys[9][:name], "King Kong", "last row name"
33
33
  assert_equal monkeys[9][:year], "1933", "last row year"
34
34
  end
35
-
35
+
36
36
  end
37
37
 
38
38
  end
data/test/test_helper.rb CHANGED
@@ -1,4 +1,3 @@
1
1
  require 'test/unit'
2
2
  require 'shoulda'
3
-
4
3
  require 'loady'
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: loady
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tee Parham
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-15 00:00:00 -06:00
13
+ date: 2011-04-18 00:00:00 -06:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -61,7 +61,7 @@ files:
61
61
  - test/test_helper.rb
62
62
  - test/test_loady.rb
63
63
  has_rdoc: true
64
- homepage: ""
64
+ homepage: http://github.com/stackpilot/loady
65
65
  licenses: []
66
66
 
67
67
  post_install_message: