Sha256: 72de2170ea0dd1ccd826dffd6b628dcf5fea2e7b87a70e5722589f95f3659501

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

#
# Copyright (c) 2019-present, Blue Marble Payroll, LLC
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#

module DateHolidays
  module Reader
    # Tells the gem how to interact with Node and provides a list of countries.
    # See the configuration section of the Readme for more inforamtion.
    class Config
      SUPPORTED_CPU_BITS = 64
      private_constant :SUPPORTED_CPU_BITS

      class << self
        attr_reader :node_path
        attr_writer :default

        def node_path=(path)
          # Clear out the cached config when the node path changes:
          @default = nil
          @node_path = path
        end

        def default
          @default ||= new(node_path: node_path)
        end

        def countries
          JsBridge.new.extract(:countries)
        end
      end

      attr_reader :node_path

      def initialize(node_path: nil)
        @node_path = node_path

        freeze
      end

      def native_mac?
        OS.osx? && OS.bits == SUPPORTED_CPU_BITS
      end

      def native_linux?
        OS.linux? && OS.bits == SUPPORTED_CPU_BITS
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
date_holidays-reader-1.0.4 lib/date_holidays/reader/config.rb
date_holidays-reader-1.0.3 lib/date_holidays/reader/config.rb
date_holidays-reader-1.0.2 lib/date_holidays/reader/config.rb
date_holidays-reader-1.0.1 lib/date_holidays/reader/config.rb
date_holidays-reader-1.0.0 lib/date_holidays/reader/config.rb
date_holidays-reader-0.9.9 lib/date_holidays/reader/config.rb