metaclass 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 +7 -0
- data/lib/metaclass/version.rb +1 -1
- data/test/object_methods_test.rb +31 -0
- data/test/test_helper.rb +5 -0
- metadata +14 -12
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d0526ebcd306c8d9d4efa13960e50277b9527de4
|
4
|
+
data.tar.gz: 858e59754f27e0ab9f5615f66d51fb3904d45dd6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8a2a49d00490d9efe542aa030b24b9e41ea29fdd1f4fa70245791252e8b3a8e5ae934d2e3db68741faec99e70937a140020c6b2f8d36956b6e1273faff8a52dc
|
7
|
+
data.tar.gz: 05380ed37140840d2a918ba0d410b091025264a1f7ec9566a3955efc03439aa1263ea204c9f63652cc2db95101d90e09ba225caecdfa7783c32f73a93bcd23d9
|
data/lib/metaclass/version.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class ObjectMethodsTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@klass = Class.new
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_define_method_on_only_one_instance_of_a_class
|
10
|
+
instance = @klass.new
|
11
|
+
assert_raises(NoMethodError) { instance.success? }
|
12
|
+
|
13
|
+
instance.__metaclass__.class_eval { def success?; true; end }
|
14
|
+
assert_nothing_raised(NoMethodError) { assert instance.success? }
|
15
|
+
|
16
|
+
another_instance = @klass.new
|
17
|
+
assert_raises(NoMethodError) { another_instance.success? }
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_metaclass_ancestors
|
21
|
+
instance = @klass.new
|
22
|
+
assert instance.__metaclass__.ancestors.include?(Object)
|
23
|
+
assert instance.__metaclass__.ancestors.include?(Kernel)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_metaclass_is_itself_a_class
|
27
|
+
instance = @klass.new
|
28
|
+
assert instance.__metaclass__.is_a?(Class)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metaclass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.0.2
|
4
|
+
version: 0.0.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- James Mead
|
9
|
-
autorequire:
|
8
|
+
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-
|
11
|
+
date: 2014-02-19 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
|
-
description:
|
13
|
+
description:
|
15
14
|
email:
|
16
15
|
- james@floehopper.org
|
17
16
|
executables: []
|
@@ -21,10 +20,13 @@ files:
|
|
21
20
|
- lib/metaclass.rb
|
22
21
|
- lib/metaclass/object_methods.rb
|
23
22
|
- lib/metaclass/version.rb
|
23
|
+
- test/object_methods_test.rb
|
24
|
+
- test/test_helper.rb
|
24
25
|
homepage: https://github.com/floehopper/metaclass
|
25
26
|
licenses:
|
26
27
|
- MIT
|
27
|
-
|
28
|
+
metadata: {}
|
29
|
+
post_install_message:
|
28
30
|
rdoc_options: []
|
29
31
|
require_paths:
|
30
32
|
- lib
|
@@ -33,17 +35,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
33
35
|
- - '>='
|
34
36
|
- !ruby/object:Gem::Version
|
35
37
|
version: '0'
|
36
|
-
none: false
|
37
38
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
39
|
requirements:
|
39
40
|
- - '>='
|
40
41
|
- !ruby/object:Gem::Version
|
41
42
|
version: '0'
|
42
|
-
none: false
|
43
43
|
requirements: []
|
44
44
|
rubyforge_project: metaclass
|
45
|
-
rubygems_version:
|
46
|
-
signing_key:
|
47
|
-
specification_version:
|
45
|
+
rubygems_version: 2.0.14
|
46
|
+
signing_key:
|
47
|
+
specification_version: 4
|
48
48
|
summary: Adds a metaclass method to all Ruby objects
|
49
|
-
test_files:
|
49
|
+
test_files:
|
50
|
+
- test/object_methods_test.rb
|
51
|
+
- test/test_helper.rb
|