chell 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/chell.rb +23 -0
- data/lib/chell/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71be7518186a15d40e27ec5cc7a0f4dd10f3d10c
|
4
|
+
data.tar.gz: 59ad235275be3eb0e65c0cbfb67bb69ae323814b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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!!**
|
data/lib/chell.rb
CHANGED
@@ -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
|
+
|
data/lib/chell/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2014-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|