bindless 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/VERSION +1 -1
- data/examples/simple_use_case.rb +1 -1
- data/lib/bindless.rb +3 -7
- data/lib/bindless/object.rb +14 -6
- data/lib/bindless/proc.rb +21 -13
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MTIzYTUyYTBlMzE0MDU5OTliN2Y0MmU0ZDE1MDcwOGI2NjM2Y2Q3Mg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2cb5c7830d749df7d6101e73a67d0e35a11fd878
|
4
|
+
data.tar.gz: 30e0f1076d004a4fe8ba17f7deb1c7237dfbf52b
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
M2M1YmE2YjFjODlmZWYyNmI2NjI0ODNlMzNjMTk2ZmNkYTYxMTllZjY1ZTEx
|
11
|
-
M2QxOGI5MDE4YzI4YzE2MjNiMWZhOTlmNzdhNGQ4NjFjNGM5NTA=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NzczMDJjZjUyNDJjMGU1ZWI0NzY0MjA0ZGEzMTBiOWQ4NzdhMzk0ZDIxMDhi
|
14
|
-
ZWVkOTQyNzUwNDZlYmQ0OTQxZjI3NjhhZTAyYjJhNzczNjliMzc5MjgwMDBi
|
15
|
-
Y2JhNWUzZjM5YjY0MjFjYmM2ODE2MGY5MWQ0N2VmYjM0YzhiNTQ=
|
6
|
+
metadata.gz: d8abfd4f4ceaec57b5ea0cd9460a2302642158d865bf6d05cbbefd491b1860ed5c262e0c3ccf1d49f95b380e6f93f12d2617899da5565578dd1f30a19cf0bd53
|
7
|
+
data.tar.gz: cf71016d689e5a64e94d1be4a06b4db5033c88951b9e128bc245fa8152d50fe82c213593999957e7743b1b6ecdca0b1920013b4849e01cf15b3b3b4d5d9fd626
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
data/examples/simple_use_case.rb
CHANGED
data/lib/bindless.rb
CHANGED
@@ -1,8 +1,4 @@
|
|
1
1
|
#encoding: UTF-8
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
require File.join(File.dirname(__FILE__),"bindless","proc")
|
6
|
-
require File.join(File.dirname(__FILE__),"bindless","object")
|
7
|
-
|
8
|
-
end
|
2
|
+
require 'bindless/model'
|
3
|
+
require 'bindless/proc'
|
4
|
+
require 'bindless/object'
|
data/lib/bindless/object.rb
CHANGED
@@ -1,10 +1,18 @@
|
|
1
|
-
|
1
|
+
module Bindless
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
module EXT
|
4
|
+
module Object
|
5
|
+
|
6
|
+
# return the object Binding
|
7
|
+
def binding?
|
8
|
+
return binding
|
9
|
+
end
|
7
10
|
|
8
|
-
|
11
|
+
alias :get_binding :binding?
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
9
15
|
|
10
16
|
end
|
17
|
+
|
18
|
+
Object.__send__ :include, Bindless::EXT::Object
|
data/lib/bindless/proc.rb
CHANGED
@@ -1,18 +1,26 @@
|
|
1
|
-
|
1
|
+
module Bindless
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
module EXT
|
4
|
+
module Proc
|
5
|
+
|
6
|
+
def call_with_binding(bind, *args)
|
7
|
+
::Bindless::Model.new([bind]).run_proc(self, *args)
|
8
|
+
end
|
9
|
+
|
10
|
+
def call_with_obj(obj, *args)
|
11
|
+
m = nil
|
12
|
+
p = self
|
13
|
+
::Object.class_eval do
|
14
|
+
define_method :a_temp_method_name, &p
|
15
|
+
m = instance_method :a_temp_method_name
|
16
|
+
remove_method :a_temp_method_name
|
17
|
+
end
|
18
|
+
m.bind(obj).call(*args)
|
19
|
+
end
|
6
20
|
|
7
|
-
def call_with_obj(obj, *args)
|
8
|
-
m = nil
|
9
|
-
p = self
|
10
|
-
Object.class_eval do
|
11
|
-
define_method :a_temp_method_name, &p
|
12
|
-
m = instance_method :a_temp_method_name
|
13
|
-
remove_method :a_temp_method_name
|
14
21
|
end
|
15
|
-
m.bind(obj).call(*args)
|
16
22
|
end
|
17
23
|
|
18
|
-
end
|
24
|
+
end
|
25
|
+
|
26
|
+
Proc.__send__ :include, Bindless::EXT::Proc
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bindless
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Run any ruby procs with different binds on the fly!
|
14
14
|
email:
|
@@ -37,19 +37,18 @@ require_paths:
|
|
37
37
|
- lib
|
38
38
|
required_ruby_version: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- -
|
40
|
+
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '0'
|
43
43
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
requirements: []
|
49
49
|
rubyforge_project:
|
50
|
-
rubygems_version: 2.2.
|
50
|
+
rubygems_version: 2.2.2
|
51
51
|
signing_key:
|
52
52
|
specification_version: 4
|
53
53
|
summary: run ruby procs with different binds on the fly!
|
54
54
|
test_files: []
|
55
|
-
has_rdoc:
|