system_navigation 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,75 @@
1
+ class SystemNavigation
2
+ class RubyEnvironment
3
+ # Execute block on each class, metaclass, module and module's metaclass.
4
+ def all_behaviors(&block)
5
+ enum = Enumerator.new do |y|
6
+ ObjectSpace.each_object(Module) do |klass|
7
+ y.yield klass
8
+ y.yield klass.singleton_class
9
+ end
10
+ end
11
+
12
+ if block_given?
13
+ enum.each(&block)
14
+ else
15
+ enum
16
+ end
17
+ end
18
+
19
+ def all_classes(&block)
20
+ enum = Enumerator.new do |y|
21
+ ObjectSpace.each_object(Class) do |klass|
22
+ y.yield klass
23
+ end
24
+ end
25
+
26
+ if block_given?
27
+ enum.each(&block)
28
+ else
29
+ enum
30
+ end
31
+ end
32
+
33
+ def all_classes_and_modules(&block)
34
+ enum = Enumerator.new do |y|
35
+ ObjectSpace.each_object(Module) do |klass|
36
+ y.yield klass
37
+ end
38
+ end
39
+
40
+ if block_given?
41
+ enum.each(&block)
42
+ else
43
+ enum
44
+ end
45
+ end
46
+
47
+ def all_modules(&block)
48
+ enum = Enumerator.new do |y|
49
+ self.all_classes_and_modules.each do |klass|
50
+ y.yield(klass) if klass.instance_of?(Module)
51
+ end
52
+ end
53
+
54
+ if block_given?
55
+ enum.each(&block)
56
+ else
57
+ enum
58
+ end
59
+ end
60
+
61
+ def all_objects(&block)
62
+ enum = Enumerator.new do |y|
63
+ ObjectSpace.each_object do |klass|
64
+ y.yield klass
65
+ end
66
+ end
67
+
68
+ if block_given?
69
+ enum.each(&block)
70
+ else
71
+ enum
72
+ end
73
+ end
74
+ end
75
+ end
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: system_navigation
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Kyrylo Silin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: fast_method_source
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.9'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.9'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.4'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.10'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.10'
69
+ description: ''
70
+ email: silin@kyrylo.org
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - CHANGELOG.md
76
+ - LICENCE.txt
77
+ - README.md
78
+ - VERSION
79
+ - lib/system_navigation.rb
80
+ - lib/system_navigation/ancestor_method_finder.rb
81
+ - lib/system_navigation/array_refinement.rb
82
+ - lib/system_navigation/compiled_method.rb
83
+ - lib/system_navigation/expression_tree.rb
84
+ - lib/system_navigation/instruction_stream.rb
85
+ - lib/system_navigation/instruction_stream/decoder.rb
86
+ - lib/system_navigation/instruction_stream/instruction.rb
87
+ - lib/system_navigation/instruction_stream/instruction/attr_instruction.rb
88
+ - lib/system_navigation/method_hash.rb
89
+ - lib/system_navigation/method_query.rb
90
+ - lib/system_navigation/module_refinement.rb
91
+ - lib/system_navigation/ruby_environment.rb
92
+ homepage: https://github.com/kyrylo/system_navigation
93
+ licenses:
94
+ - Zlib
95
+ metadata: {}
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ requirements: []
111
+ rubyforge_project:
112
+ rubygems_version: 2.4.5
113
+ signing_key:
114
+ specification_version: 4
115
+ summary: ''
116
+ test_files: []
117
+ has_rdoc: