deco 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/lib/deco.rb +16 -0
  4. metadata +46 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 844e20651f4273fb8a32945562ca907a15679ede
4
+ data.tar.gz: 0d7b737957f3975839147c8fe5eb2a87e8396e45
5
+ SHA512:
6
+ metadata.gz: 7704941fe37a3e8b14b6cf2c8dd53efbfe09dbd0d506731d8b36ea94f9cd4ff4530dc422694aa0b8c480845f70bd06ad19ab178d66d4233c7d9065524ae1811f
7
+ data.tar.gz: 574ee23b70432a3fd14a0cfbb255d25529eed542b18bb7fc40c48072261e97c10a8d616a9eaebbc0095f8abd91d4184bff821fb7332aecd1e3e217ff6017aa50
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Joe McIlvain
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,16 @@
1
+
2
+ def deco(meth, &user_block)
3
+ m = instance_method(meth)
4
+
5
+ Thread.current[:__deco_stack__] ||= []
6
+
7
+ define_method(meth) do |*args, &block|
8
+ Thread.current[:__deco_stack__].push(m.bind(self))
9
+ user_block.call *args, &block
10
+ end
11
+ end
12
+
13
+ def deco_super(*args, &block)
14
+ Thread.current[:__deco_stack__].pop.call(*args, &block)
15
+ end
16
+
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: deco
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Joe McIlvain
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-28 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Decorate an existing method in Ruby cleanly, without aliasing.
14
+ email: joe.eli.mac@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/deco.rb
20
+ - LICENSE
21
+ homepage: https://github.com/jemc/deco/
22
+ licenses:
23
+ - MIT License
24
+ - Copyright 2013 Joe McIlvain
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.1.5
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: Decorate an existing method in Ruby cleanly, without aliasing.
46
+ test_files: []