Sha256: 4415b51e0f518280cc690c1269b8056404d865141572a55d58512465b384e8b7

Contents?: true

Size: 564 Bytes

Versions: 1

Compression:

Stored size: 564 Bytes

Contents

# frozen_string_literal: true

module Cotcube
  module Indicators
    def calc(a:, b:, c:nil, d:nil, e:nil, f:nil, g:nil, h:nil, finalize: :to_f, &block)   # rubocop:disable Naming/MethodParameterName
      lambda do |x|
        block.call(
          x[a.to_sym],
          (b.nil? ? nil : x[b.to_sym]),
          (c.nil? ? nil : x[c.to_sym]),
          (d.nil? ? nil : x[d.to_sym]),
          (e.nil? ? nil : x[e.to_sym]),
          (f.nil? ? nil : x[f.to_sym]),
          (g.nil? ? nil : x[g.to_sym]),
        ).send(finalize.to_sym)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cotcube-indicators-0.1.15 lib/cotcube-indicators/calc.rb