senju_kan_non 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: 9131acc23dcd2f8a1337ca4c462a29a1407f1c2f
4
- data.tar.gz: 6cf621d0b3a1e0ab17449565dab79642d3843d6a
3
+ metadata.gz: 6fe6ba418ac43077554a1d2ed118332e0c72d740
4
+ data.tar.gz: 3ccafb372527211d4d267fbcdae5da72951dcfe5
5
5
  SHA512:
6
- metadata.gz: f618af259add2c785038ae79a654bb2e817ab9f61d84635bb1865396d9287a1c55f41509df4cd34438fa7e6a1100fa5e1b0933105142dbc5ab941dc614d905ed
7
- data.tar.gz: c602cdaab9ff386ab1ff8c24eaa6d3ebbadcdbd750d6a451348d6577c4ebd9d9117f250ab30890a28961b479aec92d27f1db85872b20a2296b02a25f661f4299
6
+ metadata.gz: 61037ce1e80492eb92a3e1f133ff3ba2d1d800bc998712a51649612d4a63119b8ec613f682e5bba9648083d24b4f8eb51a9f0b21f06e997975276480543f9fe3
7
+ data.tar.gz: 8f23f74e0d04ca86989695027132b79c216167b1493dbbed86547c1d71bbb98df0077de2f722a90bd490b692a86af43152ecf052e683e919d831efe43a6066ec
data/lib/senju_kan_non.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "senju_kan_non/version"
2
+ require "senju_kan_non/config"
2
3
 
3
4
  module SenjuKanNon
4
5
  class << self
@@ -25,7 +26,10 @@ module SenjuKanNon
25
26
  end
26
27
 
27
28
  fill_short_values(issai_shujo)
28
- parse_columns_to_row
29
+ formatted_riyaku = parse_columns_to_row
30
+ genze_riyaku(keys, formatted_riyaku) if SenjuKanNon.config.file_output
31
+
32
+ formatted_riyaku
29
33
  end
30
34
 
31
35
  def gasshou(first_eye, first_hand, second_eye, second_hand)
@@ -55,5 +59,15 @@ module SenjuKanNon
55
59
  def parse_columns_to_row
56
60
  @riyaku.values.transpose.uniq
57
61
  end
62
+
63
+ def genze_riyaku(keys, formatted_riyaku)
64
+ file_name = "#{Time.now.strftime("%Y%m%d%H%M%S")}_#{keys.join("_")}.#{SenjuKanNon.config.file_output_extension}"
65
+ FileUtils.mkdir_p(SenjuKanNon.config.file_output_path) unless FileTest.exist?(SenjuKanNon.config.file_output_path)
66
+ File.open(SenjuKanNon.config.file_output_path + file_name, "w") do |f|
67
+ formatted_riyaku.each do |fr|
68
+ f.puts(fr.to_s)
69
+ end
70
+ end
71
+ end
58
72
  end
59
73
  end
@@ -0,0 +1,24 @@
1
+ require "active_support/configurable"
2
+
3
+ module SenjuKanNon
4
+ def self.configure(&block)
5
+ yield @config ||= SenjuKanNon::Configuration.new
6
+ end
7
+
8
+ def self.config
9
+ @config
10
+ end
11
+
12
+ class Configuration
13
+ include ::ActiveSupport::Configurable
14
+ config_accessor :file_output
15
+ config_accessor :file_output_path
16
+ config_accessor :file_output_extension
17
+ end
18
+
19
+ configure do |config|
20
+ config.file_output = false
21
+ config.file_output_path = "test/senju_kan_non/"
22
+ config.file_output_extension = "txt"
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module SenjuKanNon
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -21,6 +21,8 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
+ spec.add_dependency "activesupport", ">= 5"
25
+
24
26
  spec.add_development_dependency "bundler", "~> 1.14"
25
27
  spec.add_development_dependency "rake", "~> 10.0"
26
28
  spec.add_development_dependency "rspec", "~> 3.0"
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: senju_kan_non
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - hanahiroAze
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-09 00:00:00.000000000 Z
11
+ date: 2017-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '5'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '5'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -65,13 +79,13 @@ files:
65
79
  - ".travis.yml"
66
80
  - CODE_OF_CONDUCT.md
67
81
  - Gemfile
68
- - LICENSE
69
82
  - LICENSE.txt
70
83
  - README.md
71
84
  - Rakefile
72
85
  - bin/console
73
86
  - bin/setup
74
87
  - lib/senju_kan_non.rb
88
+ - lib/senju_kan_non/config.rb
75
89
  - lib/senju_kan_non/version.rb
76
90
  - senju_kan_non.gemspec
77
91
  homepage: https://github.com/hanahiroAze/senju_kan_non
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2017 hanahiroAze
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.