jpx_industry_code 0.0.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jpx_industry_code/category.rb +8 -0
- data/lib/jpx_industry_code.rb +8 -0
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6d951e8d2d9cacdb26980d40843c23db528e5727c6b388e12e0705bcd39a50d
|
4
|
+
data.tar.gz: 9feaa3d14bddb4608ff88cb4289bc0f7c797417e33eb6471e39f0949887adde2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2bfc62adeb67566e92cb91098002ba8f5c66852c697633f77f82454297b532f79787dcf91ca488550eec9c90e606f5d2bf0a8e605cf9c6697b9d3ab5581ef49
|
7
|
+
data.tar.gz: 48d7f904a601b8e6a37ae3d2e0b5e60fea1101cf3b9eb59970dea49466f63ef8ad744dccc22ee2acaaa83f2c64839a99aae7eb153068e79fe7be884c875e972b
|
@@ -27,6 +27,8 @@ class JpxIndustryCode
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def find_by(find_option)
|
30
|
+
return nil unless validate_find_option(find_option)
|
31
|
+
|
30
32
|
all.find do |jpx_industry_code_category|
|
31
33
|
jpx_industry_code_category[find_option.flatten[0]] == find_option.flatten[1]
|
32
34
|
end
|
@@ -39,6 +41,12 @@ class JpxIndustryCode
|
|
39
41
|
raise JpxIndustryCode::Errors::InvalidArgumentError, 'Single keyword argument can be specified.' if find_option.keys.length > 1
|
40
42
|
end
|
41
43
|
|
44
|
+
def validate_find_option(find_option)
|
45
|
+
return false if !find_option.is_a?(Hash) || find_option.keys.length > 1
|
46
|
+
|
47
|
+
true
|
48
|
+
end
|
49
|
+
|
42
50
|
def raise_not_found
|
43
51
|
proc { raise JpxIndustryCode::Errors::NotFoundError }
|
44
52
|
end
|
data/lib/jpx_industry_code.rb
CHANGED
@@ -52,6 +52,8 @@ class JpxIndustryCode
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def find_by(find_option)
|
55
|
+
return nil unless validate_find_option(find_option)
|
56
|
+
|
55
57
|
all.find do |jpx_industry_code|
|
56
58
|
jpx_industry_code[find_option.flatten[0]] == find_option.flatten[1]
|
57
59
|
end
|
@@ -64,6 +66,12 @@ class JpxIndustryCode
|
|
64
66
|
raise JpxIndustryCode::Errors::InvalidArgumentError, 'Single keyword argument can be specified.' if find_option.keys.length > 1
|
65
67
|
end
|
66
68
|
|
69
|
+
def validate_find_option(find_option)
|
70
|
+
return false if !find_option.is_a?(Hash) || find_option.keys.length > 1
|
71
|
+
|
72
|
+
true
|
73
|
+
end
|
74
|
+
|
67
75
|
def raise_not_found
|
68
76
|
proc { raise JpxIndustryCode::Errors::NotFoundError }
|
69
77
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jpx_industry_code
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rui Onodera
|
@@ -9,7 +9,35 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2020-02-07 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry-byebug
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.8'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.8'
|
13
41
|
description: JPX industry code and category gem
|
14
42
|
email: deraru@gmail.com
|
15
43
|
executables: []
|