lucarecord 0.5.5 → 0.6.0

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
  SHA256:
3
- metadata.gz: 4574038ef165ecd098bd37897f77a16edb5917aa6c157ce45a005598bc540af2
4
- data.tar.gz: a2f22d1d3c9899e3c84c7662cb8859794541e31cbd116eae343deb4d4db3e415
3
+ metadata.gz: 0aa1cebca92730baae88aed3eae85d0d2c2d78c546a77fed3f1c938f17d9bebd
4
+ data.tar.gz: dfba788f46016596ae050dc2c742428ee676fead174c3825841381c03b24e62f
5
5
  SHA512:
6
- metadata.gz: 05dccaddb053508040dfab00cd9451b20b10d3a9b78a5317609ab8e71a548109cee9c4ff2579132f2e7380bb470d8639e6ddfb80ffdb23e324c2971e89d596d0
7
- data.tar.gz: e33237c779d1450bd6c1b9a1c208382a8eda87848da74117b36bc973b93c44b965e1970d8eea60eb0d83698361406700c4dbe1480d511bc0130ece78cf7c6cf3
6
+ metadata.gz: c63971e223278d08e688f96d791b517a84f8119ca1e0556a9a09685e28e821649aebbc62ab910db30060b2f13592a6f54de234aeea068d8b807fea9d6d1da29a
7
+ data.tar.gz: bf4dee90d7003d74af59a34620456c00213e51d11b9d0317468adc706bae4ed3957c0291643fcbdc87c26bb9cf867a05b5f467ecff1935ab63c1e9cda1cb0fac
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## LucaRecord 0.5.6
2
+
3
+ * add Nushell render mode: expand(default) | collapse | explore(`less` like)
4
+ * add `LucaSupport::Code.take_history()`, listing all effective/defunct values.
5
+
1
6
  ## LucaRecord 0.5.5
2
7
 
3
8
  * support JSON for `LucaRecord::Base.load_data()` w/ `@record_type = 'json'`
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LucaRecord
4
- VERSION = '0.5.5'
4
+ VERSION = '0.6.0'
5
5
  end
@@ -180,7 +180,6 @@ module LucaSupport # :nodoc:
180
180
  end
181
181
  end
182
182
 
183
- #
184
183
  # convert effective/defunct data into current hash on @date.
185
184
  # not parse nested children.
186
185
  #
@@ -221,6 +220,18 @@ module LucaSupport # :nodoc:
221
220
  latest&.dig('val') || latest
222
221
  end
223
222
 
223
+ # convert all effective/defunct data into Array
224
+ # not parse nested children.
225
+ #
226
+ def take_history(dat, item)
227
+ target = dat&.dig(item)
228
+ return Array(target) unless target.is_a?(Array)
229
+
230
+ target
231
+ .sort { |a, b| Date.parse(a['effective'].to_s) <=> Date.parse(b['effective'].to_s) }
232
+ .map { |a| a['val'] }
233
+ end
234
+
224
235
  def has_status?(dat, status)
225
236
  return false if dat['status'].nil?
226
237
 
@@ -48,7 +48,10 @@ module LucaSupport
48
48
  nil
49
49
  end
50
50
 
51
- def nushell(records, columns=[])
51
+ # render mode swithes nushell Viewer
52
+ # https://www.nushell.sh/commands/categories/viewers.html
53
+ #
54
+ def nushell(records, mode=:expand, columns=[])
52
55
  return nil if records.is_a?(String)
53
56
 
54
57
  require 'open3'
@@ -57,7 +60,15 @@ module LucaSupport
57
60
  else
58
61
  '| select --ignore-errors ' + columns.map { |col| col.gsub(/[^a-zA-Z0-9_-]/, '') }.join(' ')
59
62
  end
60
- Open3.pipeline_w(%(nu -c 'cat - | from json #{select}')) { |stdin| stdin.puts JSON.dump(records) }
63
+ render = case mode
64
+ when :explore
65
+ 'explore'
66
+ when :collapse
67
+ 'table -c'
68
+ else
69
+ 'table -e'
70
+ end
71
+ Open3.pipeline_w(%(nu -c 'cat - | from json #{select} | #{render}')) { |stdin| stdin.puts JSON.dump(records) }
61
72
  end
62
73
  end
63
74
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucarecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-17 00:00:00.000000000 Z
11
+ date: 2023-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -90,14 +90,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
90
  requirements:
91
91
  - - ">="
92
92
  - !ruby/object:Gem::Version
93
- version: 2.6.0
93
+ version: 3.0.0
94
94
  required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  requirements: []
100
- rubygems_version: 3.3.5
100
+ rubygems_version: 3.4.10
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: ERP File operation framework