table_display 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/init.rb +0 -9
- data/lib/table_display.rb +9 -0
- data/lib/table_display/version.rb +1 -1
- metadata +3 -3
data/init.rb
CHANGED
@@ -1,14 +1,5 @@
|
|
1
1
|
require 'table_display'
|
2
2
|
|
3
|
-
# all Enumerable classes should get TableDisplay functionality...
|
4
|
-
Enumerable.send(:include, TableDisplay)
|
5
|
-
|
6
|
-
# including those that have already included Enumerable by the time this plugin is loaded.
|
7
|
-
# Ruby doesn't recursively update through the module tree, so although any new classes/modules
|
8
|
-
# that include Enumerable will get TableDisplay, we have to do it ourself for older ones.
|
9
|
-
ObjectSpace.each_object(Module) {|o| o.send(:include, TableDisplay) if o.ancestors.include?(Enumerable)}
|
10
|
-
ObjectSpace.each_object(Class) {|o| o.send(:include, TableDisplay) if o.ancestors.include?(Enumerable)}
|
11
|
-
|
12
3
|
# Rails 2.3 named_scopes certainly quack like enumerables, but surprisingly they don't themself include Enumerable.
|
13
4
|
if ActiveRecord.const_defined?(:NamedScope) && ActiveRecord::NamedScope.const_defined?(:Scope)
|
14
5
|
ActiveRecord::NamedScope::Scope.send(:include, TableDisplay)
|
data/lib/table_display.rb
CHANGED
@@ -103,3 +103,12 @@ module Kernel
|
|
103
103
|
puts target.to_table(*options)
|
104
104
|
end
|
105
105
|
end
|
106
|
+
|
107
|
+
# all Enumerable classes should get TableDisplay functionality...
|
108
|
+
Enumerable.send(:include, TableDisplay)
|
109
|
+
|
110
|
+
# including those that have already included Enumerable by the time this plugin is loaded.
|
111
|
+
# Ruby doesn't recursively update through the module tree, so although any new classes/modules
|
112
|
+
# that include Enumerable will get TableDisplay, we have to do it ourself for older ones.
|
113
|
+
ObjectSpace.each_object(Module) {|o| o.send(:include, TableDisplay) if o.ancestors.include?(Enumerable)}
|
114
|
+
ObjectSpace.each_object(Class) {|o| o.send(:include, TableDisplay) if o.ancestors.include?(Enumerable)}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: table_display
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 1
|
10
|
+
version: 0.5.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Will Bryant
|