action-mapper 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/action-mapper.rb +23 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b2509c0b1ed6a1acc098fae613d51a9384feee89869b767c93faf5ed486a2f1b
4
+ data.tar.gz: fc7b9007f8ae85b709aa6e25c0c8ff40eccc6110635125d2e378eca4d93ec0de
5
+ SHA512:
6
+ metadata.gz: '080abc7954f38b4f2329f70e406465fb6bc07f5c0e5891583d757ba6ce501caf5a3ef255be0ae53a81fe7a88147508472f00c558fc154db4033f7fbd29749892'
7
+ data.tar.gz: d7e3f8462c6004f26dd26adeaf4f0a431b1601d65fe92cc19f4be2d865905b040ad735c126a17ba189ff709e0d4fce6b1affe86b4b935d6196aebc2fb31381f1
@@ -0,0 +1,23 @@
1
+ module ActionMapper
2
+
3
+ module Exceptions
4
+ class AttributesExistedError < StandardError; end
5
+ end
6
+
7
+ class ActionMapper
8
+ def initialize
9
+ @mapper = {}
10
+ end
11
+
12
+ def register(*attributes, action)
13
+ if @mapper.include? attributes
14
+ raise Exceptions::AttributesExistedError, 'Attributes existed.'
15
+ end
16
+ @mapper[attributes] = action
17
+ end
18
+
19
+ def get(*attributes)
20
+ @mapper[attributes]
21
+ end
22
+ end
23
+ end
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: action-mapper
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - TonyLE
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-07-29 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A gem that helps map attibutes to actions.
14
+ email: lpthong90@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/action-mapper.rb
20
+ homepage: https://rubygems.org/gems/action-mapper
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
+ rubygems_version: 3.1.2
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: A gem that helps map attibutes to actions.
43
+ test_files: []