pokotarou 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5c1ca5e0b1537a768623eb035c99be512b4fa31a57714ee3f0b1b5a0d4e29db
4
- data.tar.gz: 55fa713f56db0dc7d928ef3f4edc70727fc24a1c2c936d273fb58964d0cabc59
3
+ metadata.gz: 9f75bcc0cbeeed32c48874cf3ea41817cfe359d82a0aecdc1b5062365bf48d23
4
+ data.tar.gz: bd97590057da55d8a5f6f9e907c7f718030524172a545afb9f00059deb1e0fb5
5
5
  SHA512:
6
- metadata.gz: 74de5054c2bab3a5c8908239a6973442c431486ab6018bb779f598cdde3de7f6d6b596237843bd336cd963c327635fbf05d7c7c96ca3abd039bf179558336ad8
7
- data.tar.gz: 9e33defb98f9ada2032d6de9b4d300272a3dda290ad5a09590960e8412ea868616bbd110903ac53c0dd39a177ad57c2dc7b730160c2b676ff22a07221f613805
6
+ metadata.gz: 0777afe90ef3099ebe61bc5956ac9dbf0eb1eb62c4a84658f078af80ae6c40577c24eabfb35b3997b4474bb897e47ed031aab0455c9ad96c9bc2cf6ae0667083
7
+ data.tar.gz: 8c24b5afe74f74a7d2ad274c88b97fdf669c0cc5da1f3cf9d7e997569287ff53c5163a324f23b550827b8e27f1c5c699f0c19d098bdf52ca5bfd1830e7a1fa11
data/README.md CHANGED
@@ -27,7 +27,7 @@ If you use __Pokotarou__ about following table.
27
27
  |created_at|datetime|NO|
28
28
  |updated_at|datetime|NO|
29
29
 
30
- __Pokotarou__ can register in 0.41s on average.
30
+ __Pokotarou__ can register 10,000 records in 0.41s on average.
31
31
 
32
32
  ## Getting started
33
33
  Add this line to your application's Gemfile:
@@ -38,7 +38,7 @@ gem 'pokotarou'
38
38
 
39
39
  And then execute:
40
40
  ```bash
41
- $ bundle
41
+ $ bundle install
42
42
  ```
43
43
 
44
44
  Or install it yourself as:
@@ -101,4 +101,4 @@ Pref.all.count => 3
101
101
  You can read a lot more about Pokotarou in its [official docs](https://kashiwara0205.github.io/PokotarouDocs/)
102
102
 
103
103
  ## License
104
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
104
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -8,6 +8,7 @@ module Arguments
8
8
  unless hash_data.kind_of?(Hash)
9
9
  raise MisMatchArgType.new("Please use Hash for args")
10
10
  end
11
+
11
12
  @args = hash_data
12
13
  end
13
14
 
@@ -14,7 +14,7 @@ class DataRegister
14
14
  begin
15
15
  data.each do |sym_block, model_data|
16
16
  next if is_dush?(sym_block.to_s)
17
- setting_register_val_for_bulk(sym_block, model_data, maked, model_cache, maked_col)
17
+ register_val_by_bulk(sym_block, model_data, maked, model_cache, maked_col)
18
18
  end
19
19
  rescue => e
20
20
  raise StandardError.new("#{e.message}")
@@ -26,39 +26,7 @@ class DataRegister
26
26
 
27
27
  private
28
28
 
29
- =begin
30
- Commented because the influence range was large
31
- Used in later versions
32
-
33
- def merge_block data
34
- bulk_hash = {}
35
- data.each do |block, val|
36
- next if is_dush?(block.to_s)
37
- val.each do |model, config|
38
- if bulk_hash[model].nil?
39
- bulk_hash[model] = config
40
- else
41
- merge_loop(model, config, bulk_hash) if config[:loop].present?
42
- merge_seed_data(model, config, bulk_hash) if config[:col].present?
43
- end
44
- end
45
- end
46
-
47
- bulk_hash
48
- end
49
- =end
50
-
51
- def merge_loop model, config, bulk_hash
52
- bulk_hash[model][:loop] += config[:loop]
53
- end
54
-
55
- def merge_seed_data model, config, bulk_hash
56
- config[:col].each do |col_name, seed|
57
- bulk_hash[model][:col][col_name].concat(seed)
58
- end
59
- end
60
-
61
- def setting_register_val_for_bulk sym_block, model_data, maked, model_cache, maked_col
29
+ def register_val_by_bulk sym_block, model_data, maked, model_cache, maked_col
62
30
  begin
63
31
  model_data.each do |e|
64
32
  str_model = e.first.to_s
@@ -77,7 +45,7 @@ class DataRegister
77
45
  set_seed_arr(model, sym_block, sym_model, config_data, maked, maked_col)
78
46
 
79
47
  output_log(config_data[:log])
80
- register_by_bulk(sym_block, str_model, config_data ,model_cache)
48
+ insert_record(sym_block, str_model, config_data ,model_cache)
81
49
  end
82
50
  rescue => e
83
51
  raise SettingError.new("
@@ -90,7 +58,7 @@ class DataRegister
90
58
  end
91
59
  end
92
60
 
93
- def register_by_bulk sym_block, str_model, config_data, model_cache
61
+ def insert_record sym_block, str_model, config_data, model_cache
94
62
  # col_arr: [:col1, :col2, :col3]
95
63
  col_arr = config_data[:col].keys
96
64
  # seed_arr: [[elem1, elem2, elem3...]]
@@ -10,7 +10,6 @@ class ExpressionParser
10
10
  def parse config_val, maked = nil, maked_col = nil
11
11
  begin
12
12
  case
13
-
14
13
  # Array
15
14
  when is_array?(config_val)
16
15
  array_procees(config_val)
@@ -37,8 +37,8 @@ class Option
37
37
  def add option, val, cnt
38
38
  # if val is nil, return nil
39
39
  return nil if val.nil?
40
- # use '+', not use '<<' to avoid destructive effect
41
- return val + "_#{cnt}" if option == "add_id"
40
+ # not use '<<' to avoid destructive effect
41
+ return "#{val}_#{cnt}" if option == "add_id"
42
42
 
43
43
  val
44
44
  end
@@ -28,7 +28,7 @@ class PokotarouHandler
28
28
  end
29
29
 
30
30
  def get_data
31
- @data
31
+ @data.deep_dup
32
32
  end
33
33
 
34
34
  def set_data data
@@ -9,11 +9,11 @@ class Seeder
9
9
  return make_array(n, ->(){ rand(100) }) if type == "integer"
10
10
  return make_array(n, ->(){ rand(0.0..100.0) }) if type == "float"
11
11
  return make_array(n, ->(){ rand(0.0..1_000_000_000.0) }) if type == "decimal"
12
- return make_array(n, ->(){ SecureRandom.hex(20) }) if type == "string"
13
- return make_array(n, ->(){ SecureRandom.hex(300) }) if ["text", "binary"].include?(type)
12
+ return make_array(n, ->(){ "test_text test_text" }) if type == "string"
13
+ return make_array(n, ->(){ "test_long_text test_long_text test_long_text" }) if ["text", "binary"].include?(type)
14
14
  return make_array(n, ->(){ [true, false].sample }) if type == "boolean"
15
15
  return make_string_array(n, enum) if type == "string"
16
- return make_datetime_array() if ["string", "datetime", "date", "time"].include?(type)
16
+ return make_datetime_array() if ["datetime", "date", "time"].include?(type)
17
17
  end
18
18
 
19
19
  private
@@ -1,3 +1,3 @@
1
1
  module Pokotarou
2
- VERSION = '1.1.3'
2
+ VERSION = '1.1.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pokotarou
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kashiwara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-08 00:00:00.000000000 Z
11
+ date: 2020-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails