cotcube-helpers 0.1.9.1 → 0.1.9.2

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: cb81f4056cbca5f2a1630a3ddc3a63070bcf00030b78cad54163e9fca057aaaa
4
- data.tar.gz: 80cfdd92008406204cabb9add25987d49c1c3ba28b32db5c935e743e1d276470
3
+ metadata.gz: 2bfb21e47e19a7dfd33125d42d4d049d8654fbf84e36edfe081a3878e751439e
4
+ data.tar.gz: 847d6eb7b98df85dc11aadc294147542071fdb4ff83d86faac3e0ef14d204d47
5
5
  SHA512:
6
- metadata.gz: bedbd01706f4f4896acf7dc7258371c31ace12f81b8c65c6f0c057129b824d1b3087f806fe48bd8a38d0a2894c1028ec5113fa6a1f9abbd2036ea156a86ca266
7
- data.tar.gz: c17bbb49e51ced51f8ef8edefa6a781dc54598fb8ed7912df41434b6702096567f495f0cd0c873efbe020e36132e9402ac9f336e4607b151d1a34ae4600a2c3f
6
+ metadata.gz: b2a0020f5c8277b6882dbe7a00e2c885c1e86eb56b22529236b086554b7b69b398afaa1b013bb02b8f4d23f7a7444000dac77e283c7c92ecaa8e2e255e44c6f9
7
+ data.tar.gz: b8638126b407e5c4e74a0866fa7497d1c3f29af6f143b94fbca775987de78f350df75b239fd68dcc339aaa4858254b5957c3b9a1e4a4aff40d8c3b487a84a5b4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.1.9.2 (July 24, 2021)
2
+ - added missing module_functions
3
+ - init: minor fix
4
+ - datetime_ext: added warning comment / TODO, as switch from to daylight time will produce erroneous results
5
+ - constants: minor fix (typo)
6
+ - array_ext: added param to provide a default return value if result is an empty array
7
+
1
8
  ## 0.1.9.1 (May 07, 2021)
2
9
  - moved 'get_id_set' to Cotcube::Helpers
3
10
  - minor fix to suppress some warning during build
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.9.1
1
+ 0.1.9.2
@@ -17,9 +17,9 @@ require_relative 'cotcube-helpers/subpattern'
17
17
  require_relative 'cotcube-helpers/parallelize'
18
18
  require_relative 'cotcube-helpers/simple_output'
19
19
  require_relative 'cotcube-helpers/simple_series_stats'
20
+ require_relative 'cotcube-helpers/constants'
20
21
  require_relative 'cotcube-helpers/input'
21
22
  require_relative 'cotcube-helpers/reduce'
22
- require_relative 'cotcube-helpers/constants'
23
23
  require_relative 'cotcube-helpers/symbols'
24
24
  require_relative 'cotcube-helpers/init'
25
25
  require_relative 'cotcube-helpers/get_id_set'
@@ -28,6 +28,8 @@ module Cotcube
28
28
  module Helpers
29
29
  module_function :sub,
30
30
  :parallelize,
31
+ :config_path,
32
+ :config_prefix,
31
33
  :reduce,
32
34
  :simple_series_stats,
33
35
  :keystroke,
@@ -29,10 +29,10 @@ class Array
29
29
  # This method iterates over an Array by calling the given block on all 2 consecutive elements
30
30
  # it returns a Array of self.size - 1
31
31
  #
32
- def pairwise(ret=nil, &block)
32
+ def pairwise(ret=nil, empty: nil, &block)
33
33
  raise ArgumentError, 'Array.one_by_one needs an arity of 2 (i.e. |a, b|)' unless block.arity == 2
34
- raise ArgumentError, 'Each element of Array should respond to []=, at least the last one fails.' unless self.last.respond_to?(:[]=)
35
- return [] if size <= 1
34
+ raise ArgumentError, 'Each element of Array should respond to []=, at least the last one fails.' if not ret.nil? and not self.last.respond_to?(:[]=)
35
+ return empty ||= [] if size <= 1
36
36
 
37
37
  each_index.map do |i|
38
38
  next if i.zero?
@@ -47,7 +47,7 @@ class Array
47
47
  # same as pairwise, but with arity of three
48
48
  def triplewise(ret=nil, &block)
49
49
  raise ArgumentError, 'Array.triplewise needs an arity of 3 (i.e. |a, b, c|)' unless block.arity == 3
50
- raise ArgumentError, 'Each element of Array should respond to []=, at least the last one fails.' unless self.last.respond_to?(:[]=)
50
+ raise ArgumentError, 'Each element of Array should respond to []=, at least the last one fails.' if not ret.nil? and not self.last.respond_to?(:[]=)
51
51
  return [] if size <= 2
52
52
 
53
53
  each_index.map do |i|
@@ -1,8 +1,7 @@
1
-
2
- zen_string_literal: true
1
+ #frozen_string_literal: true
3
2
 
4
3
  module Cotcube
5
- module SwapSeeker
4
+ module Helpers
6
5
  SYMBOL_EXAMPLES = [
7
6
  { id: '13874U', symbol: 'ET', ticksize: 0.25, power: 1.25, months: 'HMUZ', bcf: 1.0, reports: 'LF', format: '8.2f', name: 'S&P 500 MICRO' },
8
7
  { id: '209747', symbol: 'NM', ticksize: 0.25, power: 0.5, monhts: 'HMUZ', bcf: 1.0, reports: 'LF', format: '8.2f', name: 'NASDAQ 100 MICRO' }
@@ -4,6 +4,9 @@
4
4
  class DateTime
5
5
  # based on the fact that sunday is 'wday 0' plus that trading week starts
6
6
  # sunday 0:00 (as trading starts sunday 5pm CT to fit tokyo monday morning)
7
+ #
8
+ # TODO: there is a slight flaw, that 1 sunday per year is 1 hour too short and another is 1 hour too long
9
+ #
7
10
  def to_seconds_since_sunday_morning
8
11
  wday * 86_400 + hour * 3600 + min * 60 + sec
9
12
  end
@@ -23,7 +23,7 @@ module Cotcube
23
23
  gem_name: nil,
24
24
  debug: false)
25
25
  gem_name ||= self.ancestors.first.to_s
26
- config_file_name = "#{gem_name.down_case}.yml"
26
+ config_file_name = "#{gem_name.downcase}.yml"
27
27
  config_file = config_path + "/#{config_file_name}"
28
28
 
29
29
  if File.exist?(config_file)
@@ -18,4 +18,5 @@ module Cotcube
18
18
  end
19
19
  end
20
20
 
21
+ end
21
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cotcube-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9.1
4
+ version: 0.1.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin L. Tischendorf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-07 00:00:00.000000000 Z
11
+ date: 2021-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport