easy_decorator 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/easy_decorator.rb +15 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '0981638563a7a7b60c3866cb62db7f5f6536001ea1eb7b34f5b183cd566c3345'
|
4
|
+
data.tar.gz: 27120ce76e07284129a8eb465bfa44e709c555df85d8c943920d22148845e192
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5283ab49a0a376701606965affe833fc4e86170ee7720b8f81abcd705e5544721f6a4f63739615d9e3c022bdd8695f2bc01e027bdbd8a8c3c13b79370d1865bb
|
7
|
+
data.tar.gz: ecfb801fda5318f2bf49d7689fe4947dae5aaa2eefb06dc24b845419d4c62a003a022c5d03e4bda4ee38a66e46e22ae9749997c15cebf35ee5829ab5001c66de
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module EasyDecorator
|
2
|
+
def self.prepended(base_klass)
|
3
|
+
@base_klass = base_klass
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.decorate(wrapper, wrapped)
|
7
|
+
source_method_name = "source_#{wrapped}".to_sym
|
8
|
+
cloned_method = @base_klass.instance_method(wrapped).clone
|
9
|
+
@base_klass.define_method(source_method_name, cloned_method)
|
10
|
+
|
11
|
+
define_method wrapped do |*arguments|
|
12
|
+
send(wrapper, source_method_name, *arguments)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: easy_decorator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Josh Crank
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-10-13 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Bring in Python's decorator pattern for Ruby methods.
|
14
|
+
email: joshuatcrank@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/easy_decorator.rb
|
20
|
+
homepage: https://github.com/jtcrank/easy_decorator
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.7.6
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: A method decorator for Ruby.
|
44
|
+
test_files: []
|