looksee 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 24c51228789390aabb2c8c0c231fb9c854465695
4
- data.tar.gz: f746078236c8f918c331d36de0ee2fecb4d1b0d3
3
+ metadata.gz: 782cb7d9b1208e270e0babb6f0dc772a22f3c989
4
+ data.tar.gz: 07f2a79ddac8d8e4eafe7f5fa17b8d953b480154
5
5
  SHA512:
6
- metadata.gz: ff3c7d045e9f67a2616cd7c7bd5c9cda5636e5d963c4135ac0df0d25b2c32af121e1061263bc59cdd5f7af9aae61c65f3abf0df642b4bceaf594fb59afa128d6
7
- data.tar.gz: 9912bf34301b6ebbb00aeb842039c62161f9094ed78d98392037ef14855a6d5f05010a305004ddf3d38f9e72ed77e765370a0d98783843efa4ab818816509395
6
+ metadata.gz: 4443dbd1de61a0bc900ebe4a6f6e3ac25a75b139a1731f85582c7e1188a4cbe560651ce7e20b9b0f974ea71ae0a3e467966a8413e94ce6afa4500abb1e40b400
7
+ data.tar.gz: ae3744192387ca9f866f204378a8af23cbd357841617c071e91503aaff40260d5e17d38adcf42e7e1e3b796702257dc19704921817321317d3206dcc8ebf4b19
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ == 3.0.1 2015-01-24
2
+
3
+ * Fix Looksee.rename. [Jan Lelis]
4
+ * Object.respond_to_missing?(:ls) is now true.
5
+
1
6
  == 3.0.0 2015-01-06
2
7
 
3
8
  * Support for MRI 2.2.0.
Binary file
data/lib/looksee/clean.rb CHANGED
@@ -132,6 +132,23 @@ module Looksee
132
132
  Inspector.new(lookup_path, options)
133
133
  end
134
134
 
135
+ #
136
+ # Rename the #ls method, added to every object. Example:
137
+ #
138
+ # rename :_ls
139
+ #
140
+ # This renames Looksee's #ls method to #_ls.
141
+ #
142
+ # For backward compatibility, the old-style invocation is also
143
+ # supported. Please note this is deprecated.
144
+ #
145
+ # rename :ls => :_ls
146
+ #
147
+ def rename(name)
148
+ name = name[:ls] if name.is_a?(Hash)
149
+ ObjectMixin.inspection_method = name
150
+ end
151
+
135
152
  #
136
153
  # Show a quick reference.
137
154
  #
@@ -7,42 +7,22 @@ module Looksee
7
7
  # relies on Object#ls not existing.
8
8
  #
9
9
  def method_missing(name, *args)
10
- if name == :ls
10
+ if name == Looksee::ObjectMixin.inspection_method
11
11
  Looksee[self, *args]
12
12
  else
13
13
  super
14
14
  end
15
15
  end
16
16
 
17
- def respond_to?(name, include_private=false)
18
- super || name == :ls
17
+ def respond_to_missing?(name, include_private=false)
18
+ name == Looksee::ObjectMixin.inspection_method || super
19
19
  end
20
20
 
21
- def self.rename(name) # :nodoc:
22
- name = name[:ls] if name.is_a?(Hash)
23
- alias_method name, :ls
24
- remove_method :ls
21
+ class << self
22
+ attr_accessor :inspection_method
25
23
  end
24
+ self.inspection_method = ENV['LOOKSEE_METHOD'] || :ls
26
25
  end
27
26
 
28
- #
29
- # Rename the #ls method, added to every object. Example:
30
- #
31
- # rename :_ls
32
- #
33
- # This renames Looksee's #ls method to #_ls.
34
- #
35
- # For backward compatibility, the old-style invocation is also
36
- # supported. Please note this is deprecated.
37
- #
38
- # rename :ls => :_ls
39
- #
40
- def self.rename(name)
41
- ObjectMixin.rename(name)
42
- end
43
-
44
- name = ENV['LOOKSEE_METHOD'] and
45
- rename name
46
-
47
27
  Object.send :include, ObjectMixin
48
28
  end
Binary file
@@ -1,5 +1,5 @@
1
1
  module Looksee
2
- VERSION = [3, 0, 0]
2
+ VERSION = [3, 0, 1]
3
3
 
4
4
  class << VERSION
5
5
  include Comparable
@@ -1,17 +1,43 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Looksee::ObjectMixin do
4
- describe "#ls" do
5
- before do
6
- @object = Object.new
7
- Looksee.stub(:default_specifiers).and_return([])
8
- end
4
+ before do
5
+ @object = Object.new
6
+ Looksee.stub(:default_specifiers).and_return([])
7
+ end
9
8
 
9
+ describe "#ls" do
10
10
  it "should return an Inspector for the object's lookup path using the given arguments" do
11
11
  result = @object.ls(:private)
12
12
  result.should be_a(Looksee::Inspector)
13
13
  result.lookup_path.object.should.equal?(@object)
14
14
  result.visibilities.should == Set[:private]
15
15
  end
16
+
17
+ context "when #ls is renamed" do
18
+ before { Looksee.rename(:ls2) }
19
+ after { Looksee.rename(:ls) }
20
+
21
+ it "should honor the new name" do
22
+ @object.ls2.should be_a(Looksee::Inspector)
23
+ expect { @object.ls }.to raise_error(NoMethodError)
24
+ end
25
+ end
26
+ end
27
+
28
+ describe "#respond_to_missing?" do
29
+ it "should be true for :ls" do
30
+ @object.__send__(:respond_to_missing?, :ls).should == true
31
+ end
32
+
33
+ context "when #ls renamed" do
34
+ before { Looksee.rename(:ls2) }
35
+ after { Looksee.rename(:ls) }
36
+
37
+ it "should honor the new name" do
38
+ @object.__send__(:respond_to_missing?, :ls2).should == true
39
+ @object.__send__(:respond_to_missing?, :ls).should == false
40
+ end
41
+ end
16
42
  end
17
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: looksee
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - George Ogata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-06 00:00:00.000000000 Z
11
+ date: 2015-01-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -66,6 +66,7 @@ files:
66
66
  - lib/looksee/help.rb
67
67
  - lib/looksee/inspector.rb
68
68
  - lib/looksee/lookup_path.rb
69
+ - lib/looksee/mri.bundle
69
70
  - lib/looksee/rbx.bundle
70
71
  - lib/looksee/version.rb
71
72
  - spec/looksee/adapter_spec.rb
@@ -99,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
100
  version: '0'
100
101
  requirements: []
101
102
  rubyforge_project:
102
- rubygems_version: 2.4.3
103
+ rubygems_version: 2.4.5
103
104
  signing_key:
104
105
  specification_version: 3
105
106
  summary: Supercharged method introspection in IRB.