tallty_import_export 1.0.24 → 1.0.25
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 +4 -4
 - data/Gemfile.lock +4 -4
 - data/lib/tallty_import_export/export.rb +8 -2
 - data/lib/tallty_import_export/import.rb +5 -1
 - data/lib/tallty_import_export/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: bc0e8d3d68e999a6b3f67fa31dbec4ac510d948ddb391a38ef12e06cd8d2674c
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 0c6751bba32cf9eeed209efa7aef3514cdd64d0c3db4518e717b46336b96e174
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 79b629e699808fd77b57631abd8fa2cabdc43140d524f9287c0a9ea1c5d5dfdf8fe5013f9d4422d23b7487c88c2154e39f818f2f1d32171be83ab20fb5c3ba92
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 3fcc361eebf3f0ec4cc1d9b10e0d6a5060c3fbb7c22a75841397cb172e24abd77d0d9e0cb2c6a02eec7be1702c6455aa3068a2d08eb184ae1d9f50e593c00574
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            PATH
         
     | 
| 
       2 
2 
     | 
    
         
             
              remote: .
         
     | 
| 
       3 
3 
     | 
    
         
             
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                tallty_import_export (1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
                tallty_import_export (1.0.24)
         
     | 
| 
       5 
5 
     | 
    
         
             
                  activesupport
         
     | 
| 
       6 
6 
     | 
    
         
             
                  caxlsx
         
     | 
| 
       7 
7 
     | 
    
         
             
                  redis
         
     | 
| 
         @@ -22,7 +22,7 @@ GEM 
     | 
|
| 
       22 
22 
     | 
    
         
             
                  minitest (>= 5.1)
         
     | 
| 
       23 
23 
     | 
    
         
             
                  tzinfo (~> 2.0)
         
     | 
| 
       24 
24 
     | 
    
         
             
                  zeitwerk (~> 2.3)
         
     | 
| 
       25 
     | 
    
         
            -
                caxlsx (3.1. 
     | 
| 
      
 25 
     | 
    
         
            +
                caxlsx (3.1.1)
         
     | 
| 
       26 
26 
     | 
    
         
             
                  htmlentities (~> 4.3, >= 4.3.4)
         
     | 
| 
       27 
27 
     | 
    
         
             
                  marcel (~> 1.0)
         
     | 
| 
       28 
28 
     | 
    
         
             
                  nokogiri (~> 1.10, >= 1.10.4)
         
     | 
| 
         @@ -32,7 +32,7 @@ GEM 
     | 
|
| 
       32 
32 
     | 
    
         
             
                htmlentities (4.3.4)
         
     | 
| 
       33 
33 
     | 
    
         
             
                i18n (1.8.10)
         
     | 
| 
       34 
34 
     | 
    
         
             
                  concurrent-ruby (~> 1.0)
         
     | 
| 
       35 
     | 
    
         
            -
                marcel (1.0. 
     | 
| 
      
 35 
     | 
    
         
            +
                marcel (1.0.2)
         
     | 
| 
       36 
36 
     | 
    
         
             
                mini_portile2 (2.6.1)
         
     | 
| 
       37 
37 
     | 
    
         
             
                minitest (5.14.4)
         
     | 
| 
       38 
38 
     | 
    
         
             
                nokogiri (1.12.4)
         
     | 
| 
         @@ -65,7 +65,7 @@ GEM 
     | 
|
| 
       65 
65 
     | 
    
         
             
                rspec-support (3.10.0)
         
     | 
| 
       66 
66 
     | 
    
         
             
                ruby-ole (1.2.12.2)
         
     | 
| 
       67 
67 
     | 
    
         
             
                rubyzip (2.3.2)
         
     | 
| 
       68 
     | 
    
         
            -
                spreadsheet (1. 
     | 
| 
      
 68 
     | 
    
         
            +
                spreadsheet (1.3.0)
         
     | 
| 
       69 
69 
     | 
    
         
             
                  ruby-ole
         
     | 
| 
       70 
70 
     | 
    
         
             
                tallty_duck_record (1.1.3)
         
     | 
| 
       71 
71 
     | 
    
         
             
                  activemodel (>= 5.0)
         
     | 
| 
         @@ -89,7 +89,7 @@ module TalltyImportExport 
     | 
|
| 
       89 
89 
     | 
    
         
             
                    merge_column_hash = {}
         
     | 
| 
       90 
90 
     | 
    
         
             
                    first_content_row_index = respond_to?(:first_header) ? 2 : 1
         
     | 
| 
       91 
91 
     | 
    
         | 
| 
       92 
     | 
    
         
            -
                    each_method =  
     | 
| 
      
 92 
     | 
    
         
            +
                    each_method = @each_method || :each
         
     | 
| 
       93 
93 
     | 
    
         
             
                    records.send(each_method).with_index do |record, index|
         
     | 
| 
       94 
94 
     | 
    
         
             
                      row = []
         
     | 
| 
       95 
95 
     | 
    
         
             
                      headers.each_with_index do |header, col_index|
         
     | 
| 
         @@ -123,8 +123,13 @@ module TalltyImportExport 
     | 
|
| 
       123 
123 
     | 
    
         
             
                  end
         
     | 
| 
       124 
124 
     | 
    
         
             
                end
         
     | 
| 
       125 
125 
     | 
    
         | 
| 
      
 126 
     | 
    
         
            +
                # 地处整体配置信息
         
     | 
| 
      
 127 
     | 
    
         
            +
                def export_options
         
     | 
| 
      
 128 
     | 
    
         
            +
                  {}
         
     | 
| 
      
 129 
     | 
    
         
            +
                end
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
       126 
131 
     | 
    
         
             
                def process_options options = {}
         
     | 
| 
       127 
     | 
    
         
            -
                  options = options.with_indifferent_access
         
     | 
| 
      
 132 
     | 
    
         
            +
                  options = export_options.merge(options).with_indifferent_access
         
     | 
| 
       128 
133 
     | 
    
         | 
| 
       129 
134 
     | 
    
         
             
                  @row_height ||= options.delete(:row_height) || 25
         
     | 
| 
       130 
135 
     | 
    
         
             
                  @width ||= (options.delete(:width) || 20).to_f
         
     | 
| 
         @@ -132,6 +137,7 @@ module TalltyImportExport 
     | 
|
| 
       132 
137 
     | 
    
         
             
                  @group_by ||= options.delete(:group_by)
         
     | 
| 
       133 
138 
     | 
    
         
             
                  @group_where = "#{@group_by}_eq" if @group_by.present?
         
     | 
| 
       134 
139 
     | 
    
         
             
                  @headers ||= options.delete(:headers)
         
     | 
| 
      
 140 
     | 
    
         
            +
                  @each_method ||= options.delete(:each_method)
         
     | 
| 
       135 
141 
     | 
    
         
             
                end
         
     | 
| 
       136 
142 
     | 
    
         | 
| 
       137 
143 
     | 
    
         
             
                def with_scope records
         
     | 
| 
         @@ -51,7 +51,7 @@ module TalltyImportExport 
     | 
|
| 
       51 
51 
     | 
    
         
             
                end
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
       53 
53 
     | 
    
         
             
                def process_options options
         
     | 
| 
       54 
     | 
    
         
            -
                  options = options.with_indifferent_access
         
     | 
| 
      
 54 
     | 
    
         
            +
                  options = import_options.merge(options).with_indifferent_access
         
     | 
| 
       55 
55 
     | 
    
         
             
                  @headers = options.delete(:headers) || import_headers
         
     | 
| 
       56 
56 
     | 
    
         
             
                  @primary_keys = options.delete(:primary_keys) || @headers.map { |header| header[:primary_key] ? header[:key].to_sym : nil }.compact
         
     | 
| 
       57 
57 
     | 
    
         
             
                  @params = options
         
     | 
| 
         @@ -107,6 +107,10 @@ module TalltyImportExport 
     | 
|
| 
       107 
107 
     | 
    
         
             
                  @headers ||= import_headers&.with_indifferent_access
         
     | 
| 
       108 
108 
     | 
    
         
             
                end
         
     | 
| 
       109 
109 
     | 
    
         | 
| 
      
 110 
     | 
    
         
            +
                def import_options
         
     | 
| 
      
 111 
     | 
    
         
            +
                  {}
         
     | 
| 
      
 112 
     | 
    
         
            +
                end
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
       110 
114 
     | 
    
         
             
                def import_headers **args
         
     | 
| 
       111 
115 
     | 
    
         
             
                  @headers || klass.try(:headers) || klass.try(:model_headers) || (raise ArgumentError.new('missing import_headers'))
         
     | 
| 
       112 
116 
     | 
    
         
             
                end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: tallty_import_export
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.25
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - liyijie
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2021- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2021-11-08 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: zip-zip
         
     |