inum 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +15 -6
- data/.travis.yml +3 -3
- data/lib/inum/active_record_mixin.rb +4 -0
- data/lib/inum/base.rb +4 -3
- data/lib/inum/version.rb +1 -1
- data/spec/inum/active_record_mixin_spec.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3491f1414101351d964f664aa8257409286cc49b
|
4
|
+
data.tar.gz: 1b2be9033dc22ffda1c14ef95107004e96fedbe4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6926d5d38ed53b126069ab24b56af810d453acb02b03ead4603ea15dca5258b9bf16997ca47340db02ecc43d526ace91e598907ac42cee17e62a7a6bb9bacaf8
|
7
|
+
data.tar.gz: 57f444f10bb6619a1ae8edb8e86da7ea422a93014856f0f5d258032ace0688044323f383c13315607b6dbede05f8b04229d5504803e9b6e3321c1f039e863c0e
|
data/.gitignore
CHANGED
@@ -5,18 +5,27 @@
|
|
5
5
|
.yardoc
|
6
6
|
Gemfile.lock
|
7
7
|
InstalledFiles
|
8
|
+
|
9
|
+
# doc files.
|
10
|
+
rdoc
|
8
11
|
_yardoc
|
9
|
-
|
10
|
-
doc/
|
12
|
+
doc
|
11
13
|
lib/bundler/man
|
12
|
-
|
13
|
-
|
14
|
+
|
15
|
+
# test temp files.
|
14
16
|
spec/reports
|
15
17
|
test/tmp
|
16
18
|
test/version_tmp
|
17
|
-
|
18
|
-
|
19
|
+
coverage
|
20
|
+
|
21
|
+
# temp directories.
|
22
|
+
pkg/
|
23
|
+
tmp/
|
24
|
+
temp/
|
25
|
+
|
19
26
|
|
20
27
|
# IDE Projects files.
|
21
28
|
nbproject/
|
22
29
|
.project
|
30
|
+
.idea/
|
31
|
+
|
data/.travis.yml
CHANGED
data/lib/inum/base.rb
CHANGED
@@ -104,8 +104,8 @@ module Inum
|
|
104
104
|
# @param option [Hash] Options.
|
105
105
|
# @option option [Array<Symbol>] except Except enum.
|
106
106
|
# @option option [Array<Symbol>] only Limit enum.
|
107
|
-
# @return [Array<Array>] collection.
|
108
|
-
def self.collection(option)
|
107
|
+
# @return [Array<Array>] collection. ex `[["HOGE", 0], ["FUGA", 1]]`
|
108
|
+
def self.collection(option = {})
|
109
109
|
map { |e|
|
110
110
|
next if option[:except] and option[:except].include?(e.label)
|
111
111
|
next if option[:only] and !option[:only].include?(e.label)
|
@@ -115,7 +115,8 @@ module Inum
|
|
115
115
|
|
116
116
|
# Execute the yield(block) with each member of enum.
|
117
117
|
#
|
118
|
-
# @
|
118
|
+
# @yield [enum] execute the block with enums.
|
119
|
+
# @yieldparam [Inum::Base] enum enum.
|
119
120
|
def self.each(&block)
|
120
121
|
@enums.each(&block)
|
121
122
|
end
|
data/lib/inum/version.rb
CHANGED
@@ -87,6 +87,18 @@ describe Inum::ActiveRecordMixin do
|
|
87
87
|
subject
|
88
88
|
end
|
89
89
|
end
|
90
|
+
|
91
|
+
context 'When integer value of string' do
|
92
|
+
let(:target){ '1' }
|
93
|
+
|
94
|
+
it 'set value.' do
|
95
|
+
expect {
|
96
|
+
instance.anime = target
|
97
|
+
}.to change {
|
98
|
+
instance.send(:read_attribute, :anime)
|
99
|
+
}.from(type.to_i).to(Anime.parse(1).to_i)
|
100
|
+
end
|
101
|
+
end
|
90
102
|
end
|
91
103
|
|
92
104
|
describe '#getter' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alfa-jpn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|