method_tags 0.0.1
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/method_tags.rb +35 -0
- metadata +44 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: a9a602b2aa2a78e9c231816ecd2f20ff833bd1e7
|
|
4
|
+
data.tar.gz: 5f9c0cf5710a970b9a26ff4bfbe0da240b5c931e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 8327711899684793333d4b4ca6037d857328065840231baccfae340cd9037c6af0157ee80560f1a6b89856d5b1668abc5ac772fce7f820af37cc7124b5cd0a79
|
|
7
|
+
data.tar.gz: c0e72d869256842dd0f9a674e88be5a444ac2c4494e6f8b56ef4dc65c46cdf055aa0bd597096daa9758285ee34dddb399809e9810b3845903bab84b0873a01ba
|
data/lib/method_tags.rb
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module MethodTags
|
|
2
|
+
def self.included(base)
|
|
3
|
+
puts base
|
|
4
|
+
base.extend ClassMethod
|
|
5
|
+
base.include InstanceMethod
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
module ClassMethod
|
|
9
|
+
private
|
|
10
|
+
def _tag_(*names)
|
|
11
|
+
@last_names = names
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def method_added(method_name)
|
|
15
|
+
@method_tags ||= {}
|
|
16
|
+
unless instance_variable_defined? :@last_names
|
|
17
|
+
@last_names = []
|
|
18
|
+
end
|
|
19
|
+
@last_names.each do |nm|
|
|
20
|
+
@method_tags[nm] ||= []
|
|
21
|
+
@method_tags[nm] << method_name
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
remove_instance_variable :@last_names
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
module InstanceMethod
|
|
29
|
+
private
|
|
30
|
+
def tagged_methods(tag_name)
|
|
31
|
+
tags = self.class.instance_variable_get :@method_tags
|
|
32
|
+
tags ? tags[tag_name] : []
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: method_tags
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- 60ml
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: You can tag methods to group them
|
|
14
|
+
email: bd.4975.3110@gmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- lib/method_tags.rb
|
|
20
|
+
homepage: https://github.com/60ml/method_tags
|
|
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.4.5
|
|
41
|
+
signing_key:
|
|
42
|
+
specification_version: 4
|
|
43
|
+
summary: You can tag methods to group them
|
|
44
|
+
test_files: []
|