to_ascii 0.0.1 → 0.0.2

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: 3f6cda9dc0082ac6275a254fa8bd4ab2ce7b3927
4
- data.tar.gz: 5bdd348613fddbd9d3e7a69ec9c24a2df0d1e134
3
+ metadata.gz: 91a86e677bdf4a1f775a8ef679d6b0e57fc54c2f
4
+ data.tar.gz: 2ec7fa498cd26c88412803f5169d402ca2a9eb59
5
5
  SHA512:
6
- metadata.gz: ff6e9e037d396ac2100fec23c2d5272bf64375a90a9adc5c723e10e32e4e8ace8ba2ab820698d8c8460d49768bd2a9e6ad26410b9cf28c7fbe30d3ef700f0930
7
- data.tar.gz: 2ba269b77b83ca606bf73b6cb2190a4c955cfaf46bd0478f05afdff21ea55e4c95cf6f10cea417cb64ed2b85e4207883975e3950351600c1f2eb2d65b64637f9
6
+ metadata.gz: 54c53215b6ea7d57bdecc7c9809be9e37117534af7f772faf834648a156d2678dcd6a98a0e58e375058d0692a8c62e13b27987dd3c2aa28df2a6c776be398106
7
+ data.tar.gz: b2a4a08fafd0d4763233c469b63f60369f1fc73cb2ad90969ae6e1b6742d379d70ea58c442edacc4f4d37eab90772ccd61f6d91b558d76788c28af9b3fae83d3
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # ToAscii
2
2
 
3
- TODO: Write a gem description
3
+ Adds the #to_ascii method to a number of collection type classes to print out a nicely formatted
4
+ ASCII table of the attributes of each element.
4
5
 
5
6
  ## Installation
6
7
 
@@ -18,11 +19,45 @@ Or install it yourself as:
18
19
 
19
20
  ## Usage
20
21
 
21
- TODO: Write usage instructions here
22
+ Require an adapter. By default the `to_ascii` method doesn't get added to anything until you require
23
+ one of the following:
24
+
25
+ require 'to_ascii/adapters/active_record'
26
+ require 'to_ascii/adapters/enumerable'
27
+ require 'to_ascii/adapters/array'
28
+ require 'to_ascii/adapters/all' # requires all of the above
29
+
30
+ Then:
31
+
32
+ Person.where(:last_name => 'Newton').to_ascii do
33
+ column :id, 6 # number is the column width
34
+ column :first_name, 24
35
+ column :last_name, 32
36
+ end
37
+
38
+ You can also define visitor/serializer classes based on model names:
39
+
40
+ class PersonToAscii < ToAscii::Visitor
41
+ column :id, 6
42
+ column :first_name, 24
43
+ column :last_name, 32
44
+ end
45
+
46
+ And then `Person.where(:last_name => 'Newton').to_ascii` just works. Look, ma! No block!
47
+
48
+ Or, create visitor classes that are called whatever and pass them into `#to_ascii` yourself!
49
+
50
+ class GarblyNamed < ToAscii::Visitor
51
+ column :id, 6
52
+ column :first_name, 24
53
+ column :last_name, 32
54
+ end
55
+
56
+ `Person.where(:last_name => 'Newton').to_ascii(GarblyNamed)`
22
57
 
23
58
  ## Contributing
24
59
 
25
- 1. Fork it ( http://github.com/<my-github-username>/to_ascii/fork )
60
+ 1. Fork it ( http://github.com/thejayvm/to_ascii/fork )
26
61
  2. Create your feature branch (`git checkout -b my-new-feature`)
27
62
  3. Commit your changes (`git commit -am 'Add some feature'`)
28
63
  4. Push to the branch (`git push origin my-new-feature`)
@@ -6,7 +6,5 @@ module ToAscii::Adapters::ActiveRecordExtensions
6
6
  end
7
7
  end
8
8
 
9
- ActiveSupport.on_load(:active_record) do
10
- ActiveRecord::Base.send(:extend, ToAscii::ClassExtensions)
11
- ActiveRecord::Base.send(:extend, ToAscii::Adapters::ActiveRecordExtensions)
12
- end
9
+ ActiveRecord::Base.send(:extend, ToAscii::ClassExtensions)
10
+ ActiveRecord::Base.send(:extend, ToAscii::Adapters::ActiveRecordExtensions)
@@ -1,3 +1,3 @@
1
1
  module ToAscii
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/to_ascii.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = %q{#to_ascii a collection}
12
12
  spec.description = %q{Adds the #to_ascii method to a number of collection type classes to print out a nicely formatted
13
13
  ASCII table of the attributes of each element.}
14
- spec.homepage = ""
14
+ spec.homepage = "http://github.com/thejayvm/to_ascii"
15
15
  spec.license = "MIT"
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: to_ascii
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Wall
@@ -94,7 +94,7 @@ files:
94
94
  - spec/to_ascii/adapters/array_spec.rb
95
95
  - spec/to_ascii/class_extensions_spec.rb
96
96
  - to_ascii.gemspec
97
- homepage: ''
97
+ homepage: http://github.com/thejayvm/to_ascii
98
98
  licenses:
99
99
  - MIT
100
100
  metadata: {}