is_a 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in is_a.gemspec
4
4
  gemspec
5
+
6
+ gem 'heap_dump'
data/Rakefile CHANGED
@@ -6,6 +6,9 @@ Rake::ExtensionTask.new('is_a')
6
6
 
7
7
  desc "Simple dump test,just to check if extension compiles and does not segfault on simple dump"
8
8
  task :test => :compile do
9
+
10
+ #TODO: use some testing framework like minitest...
11
+
9
12
  require "bundler/setup"
10
13
  require 'is_a'
11
14
 
@@ -43,9 +46,21 @@ task :test => :compile do
43
46
  puts "Getref FAIL"
44
47
  end
45
48
 
49
+ unless IsA.object?(obj)
50
+ puts "object? ok"
51
+ else
52
+ puts "object? FAIL"
53
+ end
54
+
55
+ if IsA.object?(c)
56
+ puts "object? ok"
57
+ else
58
+ puts "object? FAIL"
59
+ end
60
+
46
61
 
47
- require 'heap_dump'
48
- HeapDump.dump
62
+ #require 'heap_dump'
63
+ #HeapDump.dump
49
64
  end
50
65
 
51
66
  task :default => :test
data/is_a.gemspec CHANGED
@@ -18,5 +18,4 @@ Gem::Specification.new do |gem|
18
18
  gem.extensions = "ext/is_a/extconf.rb"
19
19
 
20
20
  gem.add_development_dependency "rake-compiler"
21
- gem.add_development_dependency "heap_dump"
22
21
  end
data/lib/is_a.rb CHANGED
@@ -4,5 +4,13 @@ require 'rbconfig'
4
4
  require "is_a.#{RbConfig::CONFIG['DLEXT']}"
5
5
 
6
6
  module IsA
7
- # Your code goes here...
7
+ # checks if object is an whole Object, not just BasicObject
8
+ def self.object? obj
9
+ cls = self.class_of(obj)
10
+ loop do
11
+ return true if cls == Object
12
+ next if cls = cls.superclass
13
+ return false
14
+ end
15
+ end
8
16
  end
data/lib/is_a/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module IsA
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: is_a
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-06-11 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler
16
- requirement: &70149844404480 !ruby/object:Gem::Requirement
16
+ requirement: &70170107218200 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,18 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70149844404480
25
- - !ruby/object:Gem::Dependency
26
- name: heap_dump
27
- requirement: &70149844403740 !ruby/object:Gem::Requirement
28
- none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: '0'
33
- type: :development
34
- prerelease: false
35
- version_requirements: *70149844403740
24
+ version_requirements: *70170107218200
36
25
  description: Fear weak references to BasicObject no more
37
26
  email:
38
27
  - vasilyfedoseyev@gmail.com