lucarecord 0.2.21 → 0.2.22

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: 94f10c954f77059dc814f1aac38335ca0e1597d0db8e7e754a93f6a67714cce1
4
- data.tar.gz: fd0e684124f7683e49192b231fd8f245e09c1fdd281f88fac7dcc309f92713bf
3
+ metadata.gz: 217630d4010c2341954f05600982cf641470b244440849c7816873ed8d10e8d2
4
+ data.tar.gz: f535546634069491d64b3e0359fc9a40f10059cd08d216f8a947c28d717d1c6c
5
5
  SHA512:
6
- metadata.gz: bfd7fdcc8f63dc889fcd51ae8e6e9d8a842a2b87ac5e7c7235e6c1ca9aa5f3886d86f8af71de0bf5e379a428b4c9fa15a2f300118427849da46124fcf4ee7532
7
- data.tar.gz: 7e39c7ada92fbc48aad6492362d9f22f8cfa2c3fa109183410d5de9f64641b8d566c206d165026a92f48dd2aa6b2aa310f69a1ff1d7fefc43f48226b5d2065e5
6
+ metadata.gz: 9e69a01066562a854ebe78128ead7c7d87be1227cfbce7453edf5510fa03f7b2acfbea5b334837b1c80e49e71a8a858d2d273277769e096baf29e4c90977816b
7
+ data.tar.gz: c7caf90c504940b0533441f19cde460fbb680f69937412659ac04670f009b74ed84c5a2aa120f2554a7e4cfab8d4eba62309cd5c0ace1e057fc09400fdc05cee
@@ -1,3 +1,7 @@
1
+ ## LucaRecord 0.2.22
2
+
3
+ * add `LucaSupport::View.nushell()`, render nushell table directly.
4
+
1
5
  ## LucaRecord 0.2.21
2
6
 
3
7
  * Enhance `LucaSupport::Code.delimit_num()`. Handle with BigDecimal, decimal length & delmiter customization.
@@ -62,7 +62,7 @@ module LucaRecord # :nodoc:
62
62
  def term(start_year, start_month, end_year, end_month, code = nil, basedir = @dirname)
63
63
  return enum_for(:term, start_year, start_month, end_year, end_month, code, basedir) unless block_given?
64
64
 
65
- LucaSupport::Code.encode_term(start_year, start_month, end_year, end_month).each do |subdir|
65
+ LucaSupport::Code.encode_term(start_year, start_month, end_year, end_month).each do |subdir|
66
66
  open_records(basedir, subdir, nil, code) do |f, path|
67
67
  if @record_type == 'raw'
68
68
  yield f, path
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LucaRecord
4
- VERSION = '0.2.21'
4
+ VERSION = '0.2.22'
5
5
  end
@@ -132,14 +132,18 @@ module LucaSupport
132
132
  end
133
133
 
134
134
  def readable(obj, len = LucaSupport::Config::DECIMAL_NUM)
135
- case obj.class.name
136
- when 'Array'
135
+ case obj
136
+ when Array
137
137
  obj.map { |i| readable(i) }
138
- when 'Hash'
138
+ when Hash
139
139
  obj.inject({}) { |h, (k, v)| h[k] = readable(v); h }
140
- when 'BigDecimal'
141
- parts = obj.round(len).to_s('F').split('.')
142
- len < 1 ? parts.first : "#{parts[0]}.#{parts[1][0, len]}"
140
+ when BigDecimal
141
+ if len == 0
142
+ obj.round # Integer is precise
143
+ else
144
+ parts = obj.round(len).to_s('F').split('.')
145
+ "#{parts[0]}.#{parts[1][0, len]}"
146
+ end
143
147
  else
144
148
  obj
145
149
  end
@@ -42,5 +42,10 @@ module LucaSupport
42
42
  end
43
43
  nil
44
44
  end
45
+
46
+ def nushell(yml)
47
+ require 'open3'
48
+ Open3.pipeline_w(%(nu -c 'cat - | from yaml')) { |stdin| stdin.puts yml }
49
+ end
45
50
  end
46
51
  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.2.21
4
+ version: 0.2.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-21 00:00:00.000000000 Z
11
+ date: 2020-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mail