blankslate 2.1.2.3 → 2.1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +13 -0
- data/VERSION +1 -0
- data/blankslate.gemspec +22 -0
- data/lib/blankslate.rb +2 -2
- data/spec/blankslate_spec.rb +39 -0
- metadata +37 -11
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
require 'bundler'
|
3
|
+
Bundler::GemHelper.install_tasks
|
4
|
+
|
5
|
+
task :default => :spec
|
6
|
+
|
7
|
+
require 'rake/testtask'
|
8
|
+
Rake::TestTask.new(:spec) do |test|
|
9
|
+
test.libs << '.'
|
10
|
+
test.ruby_opts = ['-rubygems']
|
11
|
+
test.pattern = 'spec/*_spec.rb'
|
12
|
+
test.verbose = true
|
13
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.2.4
|
data/blankslate.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "blankslate"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "blankslate"
|
7
|
+
s.version = File.read('VERSION')
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.summary = 'BlankSlate extracted from Builder.'
|
10
|
+
s.email = 'rubygems@6brand.com'
|
11
|
+
s.authors = ['Jim Weirich', 'David Masover', 'Jack Danger Canty']
|
12
|
+
s.email = "rubygems@6brand.com"
|
13
|
+
s.homepage = "http://github.com/masover/blankslate"
|
14
|
+
|
15
|
+
s.add_development_dependency 'rspec'
|
16
|
+
s.add_development_dependency 'bundler'
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
end
|
data/lib/blankslate.rb
CHANGED
@@ -20,8 +20,8 @@ class BlankSlate
|
|
20
20
|
# Hide the method named +name+ in the BlankSlate class. Don't
|
21
21
|
# hide +instance_eval+ or any method beginning with "__".
|
22
22
|
def hide(name)
|
23
|
-
if instance_methods.include?(name.
|
24
|
-
name !~ /^(__|instance_eval)/
|
23
|
+
if instance_methods.map(&:to_sym).include?(name.to_sym) and
|
24
|
+
name !~ /^(__|instance_eval|object_id)/
|
25
25
|
@hidden_methods ||= {}
|
26
26
|
@hidden_methods[name.to_sym] = instance_method(name)
|
27
27
|
undef_method name
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'blankslate'
|
2
|
+
require 'rspec'
|
3
|
+
|
4
|
+
describe BlankSlate do
|
5
|
+
let(:blank_slate) { BlankSlate.new }
|
6
|
+
|
7
|
+
def call(obj, meth, *args)
|
8
|
+
BlankSlate.find_hidden_method(meth).bind(obj).call(*args)
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "cleanliness" do
|
12
|
+
it "should not have many methods" do
|
13
|
+
BlankSlate.instance_methods.
|
14
|
+
map(&:to_s).sort.
|
15
|
+
should == ["__id__", "__send__", "instance_eval", "object_id"]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context "when methods are added to Object" do
|
20
|
+
after(:each) {
|
21
|
+
class Object
|
22
|
+
undef :foo
|
23
|
+
end
|
24
|
+
}
|
25
|
+
|
26
|
+
it "should still be blank" do
|
27
|
+
class Object
|
28
|
+
def foo
|
29
|
+
end
|
30
|
+
end
|
31
|
+
Object.new.foo
|
32
|
+
|
33
|
+
lambda {
|
34
|
+
BlankSlate.new.foo
|
35
|
+
}.should raise_error(NoMethodError)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blankslate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease:
|
5
|
+
version: 2.1.2.4
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Jim Weirich
|
@@ -11,12 +12,33 @@ autorequire:
|
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
14
|
|
14
|
-
date:
|
15
|
+
date: 2011-03-16 00:00:00 -07:00
|
15
16
|
default_executable:
|
16
|
-
dependencies:
|
17
|
-
|
17
|
+
dependencies:
|
18
|
+
- !ruby/object:Gem::Dependency
|
19
|
+
name: rspec
|
20
|
+
prerelease: false
|
21
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
22
|
+
none: false
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: "0"
|
27
|
+
type: :development
|
28
|
+
version_requirements: *id001
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: bundler
|
31
|
+
prerelease: false
|
32
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: "0"
|
38
|
+
type: :development
|
39
|
+
version_requirements: *id002
|
18
40
|
description:
|
19
|
-
email:
|
41
|
+
email: rubygems@6brand.com
|
20
42
|
executables: []
|
21
43
|
|
22
44
|
extensions: []
|
@@ -25,9 +47,13 @@ extra_rdoc_files: []
|
|
25
47
|
|
26
48
|
files:
|
27
49
|
- README
|
50
|
+
- Rakefile
|
51
|
+
- VERSION
|
52
|
+
- blankslate.gemspec
|
28
53
|
- lib/blankslate.rb
|
54
|
+
- spec/blankslate_spec.rb
|
29
55
|
has_rdoc: true
|
30
|
-
homepage:
|
56
|
+
homepage: http://github.com/masover/blankslate
|
31
57
|
licenses: []
|
32
58
|
|
33
59
|
post_install_message:
|
@@ -36,23 +62,23 @@ rdoc_options: []
|
|
36
62
|
require_paths:
|
37
63
|
- lib
|
38
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
39
66
|
requirements:
|
40
67
|
- - ">="
|
41
68
|
- !ruby/object:Gem::Version
|
42
69
|
version: "0"
|
43
|
-
version:
|
44
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
45
72
|
requirements:
|
46
73
|
- - ">="
|
47
74
|
- !ruby/object:Gem::Version
|
48
75
|
version: "0"
|
49
|
-
version:
|
50
76
|
requirements: []
|
51
77
|
|
52
78
|
rubyforge_project:
|
53
|
-
rubygems_version: 1.
|
79
|
+
rubygems_version: 1.6.2
|
54
80
|
signing_key:
|
55
81
|
specification_version: 3
|
56
82
|
summary: BlankSlate extracted from Builder.
|
57
|
-
test_files:
|
58
|
-
|
83
|
+
test_files:
|
84
|
+
- spec/blankslate_spec.rb
|