kouba 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07fc6742c41ec4655bac5b36014eb8b1eb2d4d7357a3c093bf7020fcbcbfedb0
4
- data.tar.gz: 8ed74333a2cce124739a0904a27e13c674380dc40052cf9cb630b42186fca59c
3
+ metadata.gz: 9005ed77d8d3d91487f4b17a124e87ff4b74d486a28a9fc9e5f08202710dc019
4
+ data.tar.gz: 7d903b55e4f6f382a16b596a0d1c967d5429bd6ab79a71438bc945531b32a3fe
5
5
  SHA512:
6
- metadata.gz: 1bcfc4d21dfbca655ce611e09e3e3c8356046262f2cc9f3eafbdd3feb44f2266474f4ee29d4d8464f31c53307a8afc542df3ceb7b6e9e476cd2fbb59021ae982
7
- data.tar.gz: 74825144ca26b75777f3a49f98eb90f85adef608b63f4b19314b8828822206f8143c2e4156b0e4395d0341a1805727617e166b7df08e4a04502fbcae57b97a71
6
+ metadata.gz: 6385d7d556478d32de68d12b3ccfe3a1bce2e10600370aef76fb3feb18757fd5048f281af1e82cf0b1899373b6aed49276d7a66bb3eef0f46ac4413671fae0a6
7
+ data.tar.gz: 75812e3e464d1610f9b99d5f851a454dc8f895f7551f91a74d6312d78f453c50199b562e6a0e36ecce8f8f336902395f5b45c1cc156aff7098f2e4489abf9a47
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Kouba
1
+ # Kouba ![Ruby](https://github.com/youpy/kouba/workflows/Ruby/badge.svg)
2
2
 
3
3
  kouba(工場) offers an implementation of simple factory pattern.
4
4
 
@@ -3,8 +3,11 @@ require "dry/inflector"
3
3
  module Kouba
4
4
  module SimpleFactory
5
5
  def self.included(mod)
6
- mod.send(:module_function, :create)
7
- mod.send(:module_function, :find)
6
+ mod.send(:module_function, :create, :find, :name_key)
7
+ end
8
+
9
+ def name_key(key)
10
+ @name_key = key
8
11
  end
9
12
 
10
13
  def find(name)
@@ -16,7 +19,7 @@ module Kouba
16
19
  end
17
20
 
18
21
  def create(config)
19
- (find(config[:name])).new(config[:options])
22
+ (find(config[@name_key ? @name_key.to_sym : :name])).new(config[:options])
20
23
  end
21
24
  end
22
25
  end
@@ -1,3 +1,3 @@
1
1
  module Kouba
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kouba
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - youpy