raicoto 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/raicoto/array/inspection.rb +0 -37
- data/lib/raicoto/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: 069716009fdfb9b3ef716db5b537074813ac8726
|
4
|
+
data.tar.gz: d6955113daa67b0cf231e92fa9fc2526ca86c6ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4531e873f9824ca20c872c2a8ec8cdf429dc90bb2ec32dc0cb8ba74d5a4f8dd7474b0d5a5d5789f1b42fac20a53ec62125e0928defeb4b59c59e038bd8d3615f
|
7
|
+
data.tar.gz: 15a76095300651e29a36d1f39e89f5903870d3c7edadaade710117f4eefe1b6327d91e0bb20638938e1d4b0ca8b8cb4d6c254dc03bdec3bbf7baa1e46d53a9a1
|
@@ -1,43 +1,6 @@
|
|
1
1
|
class ::Array
|
2
2
|
include Raicoto::Inspection
|
3
3
|
|
4
|
-
def ls(*attrs)
|
5
|
-
ActiveRecord.without_logging do
|
6
|
-
attrs.map!(&:to_s)
|
7
|
-
attrs.unshift('id')
|
8
|
-
attrs << 'name' if self._attribute_names.include?('name')
|
9
|
-
attrs << 'title' if self._attribute_names.include?('title')
|
10
|
-
attrs.uniq!
|
11
|
-
lengths = {}
|
12
|
-
records = self._all_for_ls
|
13
|
-
if records.count < 1
|
14
|
-
puts "No Records."
|
15
|
-
return
|
16
|
-
end
|
17
|
-
records.each do |r|
|
18
|
-
attrs.each do |a|
|
19
|
-
val = r
|
20
|
-
a.split('.').map{|path| val = val.send(path)}
|
21
|
-
len = val.to_s.length
|
22
|
-
lengths[a] ||= a.length
|
23
|
-
lengths[a] = [lengths[a], len].max
|
24
|
-
end
|
25
|
-
end
|
26
|
-
out = [attrs.map{|a| a.rjust(lengths[a]+1)}.join]
|
27
|
-
out += records.map { |r|
|
28
|
-
line = ""
|
29
|
-
attrs.each do |a|
|
30
|
-
val = r
|
31
|
-
a.split('.').map{|path| val = val.send(path)}
|
32
|
-
line << val.to_s.rjust(lengths[a]+1)
|
33
|
-
end
|
34
|
-
line
|
35
|
-
}
|
36
|
-
out.each{|s| puts s }
|
37
|
-
out.length - 1
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
4
|
def _all_for_ls
|
42
5
|
self
|
43
6
|
end
|
data/lib/raicoto/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raicoto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Johnston
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|