object_tree 0.0.10 → 1.0.0

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,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YjgzOWY2MGI0ZmUzMmIwZTZmYWI1NzZiODg0MmYxZjRlNjMzMWNmNQ==
5
- data.tar.gz: !binary |-
6
- Zjg2ZDcwYWJiOTFkZGM0MjVlODc3YjM2NTY1OTBjZGI0YWQ5Y2M4YQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- ZjBhYWEwYjgyYjQyNTNhMGIzZWExMmMyOGQ4NDQxYmUwN2EzOTZjZGMzNjk4
10
- OGE2ZTIzN2MxMjJiYzliYzE0MTA5MzMyYWQwMGJlMDgwYzNmOGRmYTdlMzdm
11
- NDZkMTliZjIyMmUzMWY5MjU0MDMwOWVjNGJhMjQ3NzA4MTFmZDA=
12
- data.tar.gz: !binary |-
13
- MmEwNjQ1ODg0MTVhYzhjNDUyODJhM2Q4ZmI1ZWE4MTI1YTkwYzMwNzM0NzM0
14
- Y2VlMTE2MGMzZGQ4YmExZDA3MzBiODgzNTkzZDZjYTcxOTBjZjk1MGZjYjAz
15
- MDVlMjlmYzc3YTBjNDNiNTRmM2VhNTAzMzk4YTBiOTNhMjlkMmI=
2
+ SHA1:
3
+ metadata.gz: eda02ea8be3269346e579f37b180697ed821b74f
4
+ data.tar.gz: e926a68e49f4e365215057b9f78ecae18dceb572
5
+ SHA512:
6
+ metadata.gz: b1413d955e7103a77375561949d0845f8a8c229c8a2217dafd32bec46d4e4a3d01c95dcae2d7b52c71a7700a3d2642722b30664807cc70c92caade5baa1d1d67
7
+ data.tar.gz: 1a23847e73c637de71eba4231b4e87f2636e360baf91bc840a44acd6d43a3fbf4d829041d5390bccd9a6cff8ff135790f24d186bf90144facac3380a6ea4d908
data/.gitignore CHANGED
@@ -16,8 +16,8 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
 
19
- **/*.swp
20
- *.swp
21
- **/*~
22
- *.*~
23
- *~
19
+ # RubyMine
20
+ .idea
21
+
22
+ # bundler
23
+ /vendor/bundle
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --require spec_helper
3
+ --format documentation
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.0.0
5
+ - 2.1
6
+ - 2.2
7
+ - 2.3.0
8
+ - 2.4.0
9
+ before_install: gem install bundler -v 1.14.3
data/README.md CHANGED
@@ -1,18 +1,17 @@
1
1
  # ObjectTree
2
2
 
3
- Rubyのオブジェクト関係をtreeっぽく表示
4
- 1.8の対応はまだ出来ていません。
3
+ [![Build Status](https://travis-ci.org/siman-man/object_tree.svg?branch=master)](https://travis-ci.org/siman-man/object_tree)
5
4
 
6
- ## Installation
5
+ ObjectTree is like tree command for Ruby ancestors.
7
6
 
8
- Or install it yourself as:
9
7
 
10
- $ gem install object_tree
11
-
12
- Add this line to your application's Gemfile:
8
+ ## Installation
13
9
 
14
- gem 'object_tree'
10
+ ```
11
+ $ gem install object_tree
12
+ ```
15
13
 
14
+
16
15
  ## Usage
17
16
 
18
17
  ``` ruby
@@ -24,21 +23,22 @@ end
24
23
  class B < A
25
24
  end
26
25
 
27
- class C < A
26
+ class C < B
28
27
  end
29
28
 
30
- tree = ObjectTree::Tree.create(A)
31
- tree.draw
29
+ puts ObjectTree.create(A)
32
30
  ```
33
31
 
32
+ output
33
+
34
34
  ```zsh
35
- <C>A
36
- ├──── <C>C
37
- └──── <C>B
35
+ <C> A
36
+ └───── <C> B
37
+ └───── <C> C
38
38
  ```
39
39
 
40
- こんな感じでtreeっぽく出力してくれる。
41
40
 
41
+ more complex pattern
42
42
 
43
43
  ```ruby
44
44
  require 'object_tree'
@@ -60,19 +60,24 @@ class C < A
60
60
  include E
61
61
  end
62
62
 
63
- tree = ObjectTree::Tree.create(A, true)
64
- tree.draw
65
- ```
63
+ class F < B
64
+ include E
65
+ end
66
66
 
67
- ```zsh
68
- <M>D
69
- └──── <C>A
70
- ├──── <M>E
71
- │ └──── <C>C
72
- └──── <C>B
67
+ puts ObjectTree.create(D)
73
68
  ```
74
69
 
75
- 第二引数をtrueにするとmoduleも表示してくれる。
70
+ output
71
+
72
+ ```
73
+ <M> D
74
+ └───── <C> A
75
+ ├───── <C> B
76
+ │ └───── <M> E
77
+ │ └───── <C> F
78
+ └───── <M> E
79
+ └───── <C> C
80
+ ```
76
81
 
77
82
 
78
83
  ## Contributing
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -1,3 +1,3 @@
1
- module ObjectTree
2
- VERSION = "0.0.10"
1
+ class ObjectTree
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/object_tree.rb CHANGED
@@ -1,145 +1,59 @@
1
- # encoding: utf-8
2
- require "object_tree/version"
1
+ require 'colorize'
3
2
 
4
- class Module
5
- def prepended_modules
6
- ancestors = self.ancestors
7
- ancestors[0..ancestors.find_index(self)] - [self]
8
- end
9
- end
10
-
11
- module ObjectTree
12
- class Tree
13
- attr_reader :tree
14
- SPACE_SIZE = 6
3
+ class ObjectTree
4
+ SPACE_SIZE = 8
5
+ T_LINE = '├─────'
6
+ I_LINE = '│'
7
+ L_LINE = '└─────'
15
8
 
16
- # 31: red, 32: green, 33: yellow, 34: blue, 35: pink, 36: aqua, 37: gray
17
- MCOLOR = 31
18
- CCOLOR = 32
19
-
20
- def initialize(klass, mflag = false)
21
- @tree = Hash.new{|h, k| h[k] = [] }
22
- @mflag = mflag
23
- @root_class = klass
9
+ def self.create(klass)
10
+ new(klass)
11
+ end
24
12
 
25
- if RUBY_VERSION >= "1.9" && klass == BasicObject
26
- klass = Object
27
- @tree[BasicObject] << Object
28
- end
13
+ def initialize(klass)
14
+ @queue = []
15
+ parse(klass)
16
+ end
29
17
 
30
- create_object_tree(object_list(klass))
31
- end
18
+ def to_s
19
+ @queue.join
20
+ end
32
21
 
33
- class << self
34
- alias :create :new
22
+ def output_node(klass)
23
+ if klass.instance_of?(Class)
24
+ "<#{?C.colorize(:green)}> #{klass}\n"
25
+ else
26
+ "<#{?M.colorize(:red)}> #{klass}\n"
35
27
  end
28
+ end
36
29
 
37
- def singleton(klass)
38
- class << klass; self end
39
- end
30
+ def get_line(end_line: nil, space: '')
31
+ end_line ? "#{space}#{L_LINE} " : "#{space}#{T_LINE} "
32
+ end
40
33
 
41
- def object_list(klass)
42
- ObjectSpace.each_object(singleton(klass)) do |subclass|
43
- if klass != subclass
44
- @tree[klass] << subclass
45
- object_list(subclass) unless @tree.has_key?(subclass)
46
- end
47
- end
34
+ def get_space(end_line: nil)
35
+ end_line ? ' ' * SPACE_SIZE : I_LINE + ' ' * (SPACE_SIZE-1)
36
+ end
48
37
 
49
- @tree
50
- end
38
+ def parse(klass, space = '', path: [])
39
+ path << klass
40
+ modules = get_modules(klass, path.reverse)
41
+ @queue << output_node(klass)
51
42
 
52
- def create_object_tree(tree)
53
- tree.each do |klass1, subclasses1|
54
- tree.each do |klass2, subclasses2|
55
- if klass1 > klass2
56
- tree[klass1] -= (subclasses2 - [klass2])
57
- end
58
- end
59
- end
43
+ until modules.empty?
44
+ sub = modules.shift
60
45
 
61
- tree
46
+ @queue << get_line(end_line: modules.empty?, space: space)
47
+ parse(sub, space + get_space(end_line: modules.empty?), path: path.dup)
62
48
  end
49
+ end
63
50
 
64
- def draw
65
- if @tree.size.zero?
66
- puts "\e[#{CCOLOR}m<C>\e[m#{@root_class}"
67
- else
68
- @last_check = []
69
- draw_tree({ @root_class => @tree[@root_class] }, 0)
70
- end
71
- end
72
-
73
- def draw_tree(tree, nest, root = true, last = false)
74
-
75
- @last_check[nest-1] = last if nest > 0
76
-
77
- tree.each do |klass, subclasses|
78
- if ( @mflag && klass.kind_of?(Class) && !klass.superclass.nil? )
79
- module_list = klass.ancestors[0..klass.ancestors.find_index(klass.superclass)-1].reverse - [klass, klass.superclass] - klass.prepended_modules
80
-
81
- module_list.each_with_index do |m, add|
82
- puts "\e[#{MCOLOR}m<M>\e[m#{m.inspect}"
83
- @last_check[nest] = true
84
-
85
- nest.times do |column_number|
86
- print ((@last_check[column_number])? " " : "│") + " " * SPACE_SIZE
87
- end
88
- print "└──── "
89
- nest += 1
90
- end
91
- end
92
-
93
- puts ( klass.kind_of?(Class) )? "\e[#{CCOLOR}m<C>\e[m#{klass.inspect}" : "\e[#{MCOLOR}m<M>\e[m#{klass.inspect}"
94
-
95
- subclasses.each do |sub|
96
- @last_check[nest] = true if sub == subclasses.last
97
-
98
- nest.times do |column_number|
99
- print ((@last_check[column_number])? " " : "│") + " " * SPACE_SIZE
100
- end
101
-
102
- if @tree.has_key?(sub)
103
- print ( sub == subclasses.last )? "└──── " : "├──── "
104
- if sub == subclasses.last
105
- draw_tree({ sub => @tree[sub]}, nest + 1, false, true)
106
- else
107
- draw_tree({ sub => @tree[sub]}, nest + 1, false, false)
108
- end
109
- else
110
- print "#{( sub == subclasses.last )? '└──── ' : '├──── '}"
111
- nest_count = 0
112
- if( @mflag && sub.kind_of?(Class) )
113
- module_list = sub.ancestors[0..sub.ancestors.find_index(klass)-1].reverse - ([sub, klass] + sub.prepended_modules)
114
- @last_check[nest] = ( sub == subclasses.last )? true : false
115
-
116
- module_list.each_with_index do |m, add|
117
- puts "\e[#{MCOLOR}m<M>\e[m#{m.inspect}"
118
- @last_check[nest+add+1] = true
119
-
120
- (nest+add+1).times do |column_number|
121
- print ((@last_check[column_number])? " " : "│") + " " * SPACE_SIZE
122
- end
123
- print "└──── "
124
- nest_count += 1
125
- end
126
- end
127
- puts ( sub.kind_of?(Class) )? "\e[#{CCOLOR}m<C>\e[m#{sub.inspect}" : "\e[#{MCOLOR}m<M>\e[m#{sub.inspect}"
128
-
129
- if ( @mflag && sub.kind_of?(Class) )
130
- prepended_modules = sub.prepended_modules
131
-
132
- prepended_modules.each_with_index do |m, add|
133
- (nest+nest_count+add+1).times do |column_number|
134
- print ((@last_check[column_number])? " " : "│") + " " * SPACE_SIZE
135
- end
136
- puts "└──── \e[#{MCOLOR}m<M>\e[m#{m.inspect}"
137
- @last_check[nest+add+1] = true
138
- end
139
- end
140
- end
141
- end
51
+ def get_modules(klass, path)
52
+ ObjectSpace.each_object(Module).map do |k|
53
+ l = k.ancestors
54
+ if l.each_cons(path.size).include?(path)
55
+ (l[l.index(k)..l.index(klass)] - path).last
142
56
  end
143
- end
57
+ end.compact.uniq
144
58
  end
145
59
  end
data/object_tree.gemspec CHANGED
@@ -8,16 +8,20 @@ Gem::Specification.new do |spec|
8
8
  spec.version = ObjectTree::VERSION
9
9
  spec.authors = ["siman-man"]
10
10
  spec.email = ["k128585@ie.u-ryukyu.ac.jp"]
11
- spec.description = "this is ruby object tree show like tree commnad!"
12
- spec.summary = "tree command like show object hierarchy"
11
+ spec.description = "like tree command for Ruby ancestors."
12
+ spec.summary = "like tree command for Ruby ancestors."
13
13
  spec.homepage = "https://github.com/siman-man/object_tree"
14
14
  spec.license = "MIT"
15
+ spec.required_ruby_version = '>= 2.0.0'
15
16
 
16
17
  spec.files = `git ls-files`.split($/)
17
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
20
  spec.require_paths = ["lib"]
20
21
 
21
- spec.add_development_dependency "bundler", "~> 1.3"
22
- spec.add_development_dependency "rake"
22
+ spec.add_dependency 'colorize'
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.14"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
23
27
  end
@@ -0,0 +1,72 @@
1
+ module Case1
2
+ class A
3
+ end
4
+
5
+ class B < A
6
+ end
7
+
8
+ class C < B
9
+ end
10
+ end
11
+
12
+ module Case2
13
+ module A
14
+ end
15
+
16
+ class B
17
+ include A
18
+ end
19
+ end
20
+
21
+ module Case3
22
+ class A
23
+ end
24
+
25
+ class B < A
26
+ end
27
+
28
+ class C < A
29
+ end
30
+ end
31
+
32
+ module Case4
33
+ module D
34
+ end
35
+
36
+ module E
37
+ end
38
+
39
+ class A
40
+ include D
41
+ end
42
+
43
+ class B < A
44
+ end
45
+
46
+ class C < A
47
+ include E
48
+ end
49
+ end
50
+
51
+ module Case5
52
+ module D
53
+ end
54
+
55
+ module E
56
+ end
57
+
58
+ class A
59
+ include D
60
+ end
61
+
62
+ class B < A
63
+ end
64
+
65
+ class C < A
66
+ include E
67
+ end
68
+
69
+ class F < B
70
+ include E
71
+ end
72
+ end
@@ -0,0 +1,60 @@
1
+ require 'fixtures/example'
2
+
3
+ describe ObjectTree do
4
+ describe 'examples' do
5
+ it 'test case 1' do
6
+ expect =<<-EXPECT
7
+ <C> Case1::A
8
+ └───── <C> Case1::B
9
+ └───── <C> Case1::C
10
+ EXPECT
11
+
12
+ expect(ObjectTree.create(Case1::A).to_s.uncolorize).to eq(expect)
13
+ end
14
+
15
+ it 'test case 2' do
16
+ expect =<<-EXPECT
17
+ <M> Case2::A
18
+ └───── <C> Case2::B
19
+ EXPECT
20
+
21
+ expect(ObjectTree.create(Case2::A).to_s.uncolorize).to eq(expect)
22
+ end
23
+
24
+ it 'test case 3' do
25
+ expect =<<-EXPECT
26
+ <C> Case3::A
27
+ ├───── <C> Case3::C
28
+ └───── <C> Case3::B
29
+ EXPECT
30
+
31
+ expect(ObjectTree.create(Case3::A).to_s.uncolorize).to eq(expect)
32
+ end
33
+
34
+ it 'test case 4' do
35
+ expect =<<-EXPECT
36
+ <M> Case4::D
37
+ └───── <C> Case4::A
38
+ ├───── <M> Case4::E
39
+ │ └───── <C> Case4::C
40
+ └───── <C> Case4::B
41
+ EXPECT
42
+
43
+ expect(ObjectTree.create(Case4::D).to_s.uncolorize).to eq(expect)
44
+ end
45
+
46
+ it 'test case 5' do
47
+ expect =<<-EXPECT
48
+ <M> Case5::D
49
+ └───── <C> Case5::A
50
+ ├───── <C> Case5::B
51
+ │ └───── <M> Case5::E
52
+ │ └───── <C> Case5::F
53
+ └───── <M> Case5::E
54
+ └───── <C> Case5::C
55
+ EXPECT
56
+
57
+ expect(ObjectTree.create(Case5::D).to_s.uncolorize).to eq(expect)
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,106 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+
20
+ require 'object_tree'
21
+
22
+ RSpec.configure do |config|
23
+ # rspec-expectations config goes here. You can use an alternate
24
+ # assertion/expectation library such as wrong or the stdlib/minitest
25
+ # assertions if you prefer.
26
+ config.expect_with :rspec do |expectations|
27
+ # This option will default to `true` in RSpec 4. It makes the `description`
28
+ # and `failure_message` of custom matchers include text for helper methods
29
+ # defined using `chain`, e.g.:
30
+ # be_bigger_than(2).and_smaller_than(4).description
31
+ # # => "be bigger than 2 and smaller than 4"
32
+ # ...rather than:
33
+ # # => "be bigger than 2"
34
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
35
+ end
36
+
37
+ # rspec-mocks config goes here. You can use an alternate test double
38
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
39
+ config.mock_with :rspec do |mocks|
40
+ # Prevents you from mocking or stubbing a method that does not exist on
41
+ # a real object. This is generally recommended, and will default to
42
+ # `true` in RSpec 4.
43
+ mocks.verify_partial_doubles = true
44
+ end
45
+
46
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
47
+ # have no way to turn it off -- the option exists only for backwards
48
+ # compatibility in RSpec 3). It causes shared context metadata to be
49
+ # inherited by the metadata hash of host groups and examples, rather than
50
+ # triggering implicit auto-inclusion in groups with matching metadata.
51
+ config.shared_context_metadata_behavior = :apply_to_host_groups
52
+
53
+ # The settings below are suggested to provide a good initial experience
54
+ # with RSpec, but feel free to customize to your heart's content.
55
+ =begin
56
+ # This allows you to limit a spec run to individual examples or groups
57
+ # you care about by tagging them with `:focus` metadata. When nothing
58
+ # is tagged with `:focus`, all examples get run. RSpec also provides
59
+ # aliases for `it`, `describe`, and `context` that include `:focus`
60
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
61
+ config.filter_run_when_matching :focus
62
+
63
+ # Allows RSpec to persist some state between runs in order to support
64
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
65
+ # you configure your source control system to ignore this file.
66
+ config.example_status_persistence_file_path = "spec/examples.txt"
67
+
68
+ # Limits the available syntax to the non-monkey patched syntax that is
69
+ # recommended. For more details, see:
70
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
71
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
72
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
73
+ config.disable_monkey_patching!
74
+
75
+ # This setting enables warnings. It's recommended, but in some cases may
76
+ # be too noisy due to issues in dependencies.
77
+ config.warnings = true
78
+
79
+ # Many RSpec users commonly either run the entire suite or an individual
80
+ # file, and it's useful to allow more verbose output when running an
81
+ # individual spec file.
82
+ if config.files_to_run.one?
83
+ # Use the documentation formatter for detailed output,
84
+ # unless a formatter has already been configured
85
+ # (e.g. via a command-line flag).
86
+ config.default_formatter = 'doc'
87
+ end
88
+
89
+ # Print the 10 slowest examples and example groups at the
90
+ # end of the spec run, to help surface which specs are running
91
+ # particularly slow.
92
+ config.profile_examples = 10
93
+
94
+ # Run specs in random order to surface order dependencies. If you find an
95
+ # order dependency and want to debug it, you can fix the order by providing
96
+ # the seed, which is printed after each run.
97
+ # --seed 1234
98
+ config.order = :random
99
+
100
+ # Seed global randomization in this process using the `--seed` CLI option.
101
+ # Setting this allows you to use `--seed` to deterministically reproduce
102
+ # test failures related to randomization by passing the same `--seed` value
103
+ # as the one that triggered the failure.
104
+ Kernel.srand config.seed
105
+ =end
106
+ end
metadata CHANGED
@@ -1,60 +1,91 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: object_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - siman-man
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-20 00:00:00.000000000 Z
11
+ date: 2017-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: colorize
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
- - - ~>
31
+ - - "~>"
18
32
  - !ruby/object:Gem::Version
19
- version: '1.3'
33
+ version: '1.14'
20
34
  type: :development
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
- - - ~>
38
+ - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: '1.3'
40
+ version: '1.14'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - ! '>='
45
+ - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '0'
47
+ version: '10.0'
34
48
  type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - ! '>='
52
+ - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '0'
41
- description: this is ruby object tree show like tree commnad!
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: like tree command for Ruby ancestors.
42
70
  email:
43
71
  - k128585@ie.u-ryukyu.ac.jp
44
72
  executables: []
45
73
  extensions: []
46
74
  extra_rdoc_files: []
47
75
  files:
48
- - .gitignore
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
49
79
  - Gemfile
50
80
  - LICENSE.txt
51
81
  - README.md
52
82
  - Rakefile
53
- - example/sample.rb
54
- - example/sample2.rb
55
83
  - lib/object_tree.rb
56
84
  - lib/object_tree/version.rb
57
85
  - object_tree.gemspec
86
+ - spec/fixtures/example.rb
87
+ - spec/object_tree_spec.rb
88
+ - spec/spec_helper.rb
58
89
  homepage: https://github.com/siman-man/object_tree
59
90
  licenses:
60
91
  - MIT
@@ -65,18 +96,21 @@ require_paths:
65
96
  - lib
66
97
  required_ruby_version: !ruby/object:Gem::Requirement
67
98
  requirements:
68
- - - ! '>='
99
+ - - ">="
69
100
  - !ruby/object:Gem::Version
70
- version: '0'
101
+ version: 2.0.0
71
102
  required_rubygems_version: !ruby/object:Gem::Requirement
72
103
  requirements:
73
- - - ! '>='
104
+ - - ">="
74
105
  - !ruby/object:Gem::Version
75
106
  version: '0'
76
107
  requirements: []
77
108
  rubyforge_project:
78
- rubygems_version: 2.0.3
109
+ rubygems_version: 2.6.10
79
110
  signing_key:
80
111
  specification_version: 4
81
- summary: tree command like show object hierarchy
82
- test_files: []
112
+ summary: like tree command for Ruby ancestors.
113
+ test_files:
114
+ - spec/fixtures/example.rb
115
+ - spec/object_tree_spec.rb
116
+ - spec/spec_helper.rb
data/example/sample.rb DELETED
@@ -1,13 +0,0 @@
1
- require 'object_tree'
2
-
3
- class A
4
- end
5
-
6
- class B < A
7
- end
8
-
9
- class C < A
10
- end
11
-
12
- tree = ObjectTree::Tree.create(A, true)
13
- tree.draw
data/example/sample2.rb DELETED
@@ -1,21 +0,0 @@
1
- require 'object_tree'
2
-
3
- module D
4
- end
5
-
6
- module E
7
- end
8
-
9
- class A
10
- include D
11
- end
12
-
13
- class B < A
14
- end
15
-
16
- class C < A
17
- include E
18
- end
19
-
20
- tree = ObjectTree::Tree.create(A, true)
21
- tree.draw