chell 0.1.1 → 0.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 460c398803a032b51a1d432bac5803d66ea207df
4
- data.tar.gz: dee8eea47a2feb303fe8462a1bbcdb76573e2276
3
+ metadata.gz: 71be7518186a15d40e27ec5cc7a0f4dd10f3d10c
4
+ data.tar.gz: 59ad235275be3eb0e65c0cbfb67bb69ae323814b
5
5
  SHA512:
6
- metadata.gz: 63119efdca92d63c4ac762d88924e0eb53d4fc577bc87ebc3a7ad46b634bfe91d729de71bd532ec87a14b468169a5e05f66c81f43731b033a82b1a30d6ca7b78
7
- data.tar.gz: 90884347b119d218bd1802dfde6117a054bc2d2be2460d5a353d2d18e1da0790903a13b1189871feb4e4250705cb904225a9893d1af3129ec840ae834675bf5c
6
+ metadata.gz: cfa866ffc628635492225d83a07933e504fe5a4ff57787ee3055d9d79696f33d9383744bd25e0caeb6faf039515f97a42ae5821f06c6f172915fbf6ea6aafb1b
7
+ data.tar.gz: 95fc9619e76875cab0ef078b49c899da9f6e0a6b9fefcd2a7626de4bf2772ae7435e782a37334473e265f09a2527d8d37ba77a4ef73ab72d5a444d2857506e12
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Chell
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/chell.png)](http://badge.fury.io/rb/chell) [![Dependency Status](https://gemnasium.com/toooooooby/chell.png)](https://gemnasium.com/toooooooby/chell) [![Code Climate](https://codeclimate.com/github/toooooooby/chell.png)](https://codeclimate.com/github/toooooooby/chell)
4
+
3
5
  ![Temporary Chell's logo](https://raw.github.com/toooooooby/chell/master/resources/logo.png)
4
6
 
5
7
  Ruby + csv + [pry] + [lambda_driver] => csv-shell => **Chell!!**
@@ -5,6 +5,8 @@ require 'pry'
5
5
 
6
6
  module Chell
7
7
  class CSV
8
+ attr_reader :table
9
+
8
10
  def initialize(data, options = {})
9
11
  @options = {headers: true}.merge(options)
10
12
  @table = ::CSV.new(data, @options).read
@@ -37,6 +39,7 @@ module Chell
37
39
  def csv; self; end
38
40
  def s; size; end
39
41
  def l; length; end
42
+ def h; headers; end
40
43
  # def column(*args); col(*args); end
41
44
  # def c(*args); col(*args); end
42
45
  # def r(*args); row(*args); end
@@ -54,3 +57,23 @@ module Chell
54
57
  end
55
58
 
56
59
  end
60
+
61
+ # An alias method for using Chell
62
+ #
63
+ # csv = Chell(File.read('example.csv'))
64
+ # p csv.headers
65
+ #
66
+ # If a block is given, `csv.table` is passed the block.
67
+ #
68
+ # Chell(File.read('example.csv')) do |csv|
69
+ # p csv.headers
70
+ # end
71
+ def Chell(*args, &block)
72
+ table = Chell::CSV.new(*args).table
73
+ if block_given?
74
+ yield table
75
+ else
76
+ table
77
+ end
78
+ end
79
+
@@ -1,3 +1,3 @@
1
1
  module Chell
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - toooooooby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-27 00:00:00.000000000 Z
11
+ date: 2014-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry