binding_of_caller 0.7 → 0.7.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: f04635fb28639852333bfbee1550220af00a4028
4
- data.tar.gz: 5badb7913920490c656b9474ce86f7cc4a942b16
3
+ metadata.gz: eb405aa7190a04a128baff727db90ef40ae1468c
4
+ data.tar.gz: 43cc746def25b335c279df78b070d926bdb43ebc
5
5
  SHA512:
6
- metadata.gz: e2fac2a7efe9388ba217124dd615d66b4b4732faad53f8211543047315acb0ebea803f9d31d842c990ef34f80fba6792a1f2ae6ab04c78d7cf496f5923c2ed34
7
- data.tar.gz: 500c220951bb64eb5597b4e5beae0dc1ba5a01e3cd9818012845f313740a5d80f631b0b3b36832ab437c5a856af5cd8b21ae4945c100389778bed2cacc7e24ec
6
+ metadata.gz: 2352e3c209510a9bed92399403425165c3b18bdaa559803d6a042ff5b98b52e70fb9b299236dad9d9895e06b533bcee7a3f1952bd8e7fea972d944b244e8e345
7
+ data.tar.gz: 7e47b06c1867cec238f1a772a8659acc738b328fd4425601b7a0bb7ce55925be0ebbbee43709bc453efef4ba41e989eed560d6ed7232fc030b83b2c17185910a
@@ -13,12 +13,6 @@ module BindingOfCaller
13
13
  end
14
14
  end
15
15
 
16
- # The description of the frame.
17
- # @return [String]
18
- def frame_description
19
- @frame_description ||= @iseq.label
20
- end
21
-
22
16
  # Return bindings for all caller frames.
23
17
  # @return [Array<Binding>]
24
18
  def callers
@@ -54,15 +48,22 @@ module BindingOfCaller
54
48
  # The type of the frame.
55
49
  # @return [Symbol]
56
50
  def frame_type
51
+ return nil if !@iseq
52
+
57
53
  # apparently the 9th element of the iseq array holds the frame type
58
54
  # ...not sure how reliable this is.
59
55
  @frame_type ||= @iseq.to_a[9]
60
56
  end
61
57
 
58
+ # The description of the frame.
59
+ # @return [String]
60
+ def frame_description
61
+ return nil if !@iseq
62
+ @frame_description ||= @iseq.label
63
+ end
62
64
  end
63
65
  end
64
66
 
65
-
66
67
  class ::Binding
67
68
  include BindingOfCaller::BindingExtensions
68
69
  end
@@ -1,3 +1,3 @@
1
1
  module BindingOfCaller
2
- VERSION = "0.7"
2
+ VERSION = "0.7.1"
3
3
  end
@@ -84,8 +84,12 @@ describe BindingOfCaller do
84
84
  binding.frame_count.should == binding.callers.count
85
85
  end
86
86
  end
87
-
87
+
88
88
  describe "frame_descripton" do
89
+ it 'can be called on ordinary binding without raising' do
90
+ lambda { binding.frame_description }.should.not.raise
91
+ end
92
+
89
93
  it 'describes a block frame' do
90
94
  binding.of_caller(0).frame_description.should =~ /block/
91
95
  end
@@ -107,6 +111,10 @@ describe BindingOfCaller do
107
111
  end
108
112
 
109
113
  describe "frame_type" do
114
+ it 'can be called on ordinary binding without raising' do
115
+ lambda { binding.frame_type }.should.not.raise
116
+ end
117
+
110
118
  it 'should return the correct frame types' do
111
119
  o = Object.new
112
120
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binding_of_caller
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.7'
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mair (banisterfiend)