that_object_is_so_basic 0.0.2 → 0.0.3

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
  SHA256:
3
- metadata.gz: a03295eac342f2c2d70888054c2cfab6bd6b6c30bb418da208623e7b9c81d62d
4
- data.tar.gz: 5beaf35ffcfab4d257a61768327c0bf0eec369ad4d85ad166f291460aa041ac3
3
+ metadata.gz: b3240b6bc2376e8bbd65e92e3efe56d316d9f38c914e56aa0a023e4aafce5f9e
4
+ data.tar.gz: c07e199fd6558461208354792815bfc6dc5ed3b3c4ebb06563259c8064fb851c
5
5
  SHA512:
6
- metadata.gz: 9402a5a10ba77da4ce3adf4c1ed4e703748f39744964d0b118de5b8e3130a3d9c313b5d26dde7fcabe90ba6945c344bcaefc2b89f50f5a140766fa6d5fecbabe
7
- data.tar.gz: c6dbf0a1afffbed5e48ac75566c1c2002ac601f35354d07213331b95acb738beb0f07f468a57d869877bce31dc5e3231847baeaaade09c78443224594d448717
6
+ metadata.gz: 629bd1061c85d0f22d9b77f9f69e86b9c624fee8ad996acba880e335cda66afe5555771914f8f9a56efe43bcea27edbd9a42ab2b519a3ccb12d8da7cb4ee6e58
7
+ data.tar.gz: 20d2695a437b94d17598ba8687871b9179d708cb16f56ef3738dd61aa279c1c6f5d9e75322606aba72e3f905afc35e9d4f579979798845c6b85f2153ec704a0c
data/README.markdown CHANGED
@@ -3,6 +3,10 @@ That Object is So Basic!
3
3
 
4
4
  TOISB lets you play with BasicObject and other weird objects in Ruby in style and without breaking (as many) things.
5
5
 
6
+ [![Gem](https://img.shields.io/gem/v/that_object_is_so_basic.svg?style=for-the-badge)](https://rubygems.org/gems/that_object_is_so_basic)
7
+ [![Travis (.org)](https://img.shields.io/travis/acook/that_object_is_so_basic.svg?style=for-the-badge)](https://travis-ci.org/acook/that_object_is_so_basic)
8
+ [![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/acook/that_object_is_so_basic.svg?style=for-the-badge)](https://codeclimate.com/github/acook/that_object_is_so_basic)
9
+
6
10
  Usage
7
11
  -----
8
12
 
data/lib/toisb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module TOISB
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/toisb/wrapper.rb CHANGED
@@ -20,7 +20,7 @@ module TOISB; class Wrapper
20
20
 
21
21
  # Collects the ancestors of an object
22
22
  def ancestors
23
- @ancestors ||= safe_send_to singleton, :ancestors
23
+ @ancestors ||= singleton.ancestors
24
24
  end
25
25
 
26
26
  # Collects only the ancestors which are Classes
@@ -30,12 +30,12 @@ module TOISB; class Wrapper
30
30
 
31
31
  # Returns the class of the object if it isn't already a class
32
32
  def klass
33
- @klass ||= Module === object ? object : ancestor_klasses[1]
33
+ @klass ||= singleton.superclass
34
34
  end
35
35
 
36
36
  # Returns the superclass of the object
37
37
  def superklass
38
- ancestor_klasses[2]
38
+ klass.superclass
39
39
  end
40
40
 
41
41
  # Gets the object ID of an object
@@ -50,6 +50,7 @@ module TOISB; class Wrapper
50
50
 
51
51
  # This is here so you can pass in an arbitrary object
52
52
  def safe_send_to target, method, *args, &block
53
+ raise NotImplementedError, "Bind functionality wasn't added until Ruby 2.0." if ::RUBY_VERSION < "2.0.0"
53
54
  (Module === target ? Module : Object).instance_method(method).bind(target).call(*args, &block)
54
55
  end
55
56
 
@@ -16,11 +16,12 @@ spec "can get the singleton class of a BasicObject subclass" do
16
16
  actual.include?(expected) || actual
17
17
  end
18
18
 
19
+ # FIXME: Is it possible to get this to work on 2.0-2.2?
19
20
  spec "can send common Object methods safely to a BasicObject subclass" do
20
21
  expected = "#<TestObject:"
21
22
  actual = toisb.safe_send :to_s
22
23
  actual.include?(expected) || actual
23
- end
24
+ end unless RUBY_VERSION < "2.3.0"
24
25
 
25
26
  spec "can get the class of a BasicObject" do
26
27
  expected = "TestObject"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: that_object_is_so_basic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony M. Cook