custom_event 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bdef9b47f66f737fa39cf528c4d93ec8dd5cd693c2565430cd79d7126e57ddca
4
+ data.tar.gz: 3c6b33def0494e1d15cc57c2f5c69f648283c5faf193dec191c60c6b33974098
5
+ SHA512:
6
+ metadata.gz: 370fce011b0fd03b0be4d54772576c53f360a4540d22f4a41cbc4441160b64b7cd55453204134f57f61f3a3c9b3d322150bd91f6ee69be7a9998790583ac29a8
7
+ data.tar.gz: a5119a002eb3d5cf064ac93c3acb16a2b7b33ddcce3ff78a2def3e25f6a81a974c3f5a7508b9428fd1b54f1bc55db7e452d6e019b50090e11eef2ea75f2c4447
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2021 ian
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # CustomEvent
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'custom_event'
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install custom_event
22
+ ```
23
+
24
+ ## Contributing
25
+ Contribution directions go here.
26
+
27
+ ## License
28
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require "bundler/setup"
2
+
3
+ require "bundler/gem_tasks"
4
+
5
+ require "rake/testtask"
6
+
7
+ Rake::TestTask.new(:test) do |t|
8
+ t.libs << 'test'
9
+ t.pattern = 'test/**/*_test.rb'
10
+ t.verbose = false
11
+ end
12
+
13
+ task default: :test
@@ -0,0 +1,7 @@
1
+ require "custom_event/version"
2
+ require "custom_event/railtie"
3
+ require "custom_event/core_ext"
4
+
5
+ module CustomEvent
6
+ # Your code goes here...
7
+ end
@@ -0,0 +1,21 @@
1
+
2
+ Object.class_eval do
3
+ def custom_event(event)
4
+ define_method event do
5
+ unless block_given?
6
+ raise "Event defined without block given"
7
+ end
8
+
9
+ before_hook = "before_#{event}"
10
+ around_hook = "around_#{event}"
11
+ after_hook = "after_#{event}"
12
+
13
+ send before_hook if respond_to? before_hook
14
+ send around_hook if respond_to? around_hook
15
+ value = yield
16
+ send around_hook if respond_to? around_hook
17
+ send after_hook if respond_to? after_hook
18
+ value
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,4 @@
1
+ module CustomEvent
2
+ class Railtie < ::Rails::Railtie
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module CustomEvent
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :custom_event do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: custom_event
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - ian
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-04-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 6.1.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 6.1.3
27
+ description: Description of CustomEvent.
28
+ email:
29
+ - ianlynxk@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - MIT-LICENSE
35
+ - README.md
36
+ - Rakefile
37
+ - lib/custom_event.rb
38
+ - lib/custom_event/core_ext.rb
39
+ - lib/custom_event/railtie.rb
40
+ - lib/custom_event/version.rb
41
+ - lib/tasks/custom_event_tasks.rake
42
+ homepage: https://mini-geek.com
43
+ licenses:
44
+ - MIT
45
+ metadata:
46
+ allowed_push_host: https://rubygems.org
47
+ homepage_uri: https://mini-geek.com
48
+ source_code_uri: https://github.com/otorain/custom_hook
49
+ changelog_uri: https://github.com/otorain/custom_hook/CHANGELOG.md
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubygems_version: 3.2.13
66
+ signing_key:
67
+ specification_version: 4
68
+ summary: Summary of CustomEvent.
69
+ test_files: []