Sha256: 90006ba0122af6e20b49f3501d916f78d1cffd24eb523a280ed504330ad0b663

Contents?: true

Size: 729 Bytes

Versions: 4

Compression:

Stored size: 729 Bytes

Contents

# frozen_string_literal: true

require_relative '../output/logger'

# :nodoc:
module Zakuro
  #
  # Tools 汎用メソッド群
  #
  module Tools
    # :reek:UncommunicativeVariableName {accept: e}

    #
    # Typeconv 型変換
    #
    module Typeconv
      LOGGER = Output::Logger.new(location: 'Typeconv')

      #
      # 文字列を10進数で数値化する
      #
      # @param [String] text 対象文字列
      # @param [Integer] default デフォルト数値
      #
      # @return [Integer] 数値
      #
      def self.to_i(text:, default:)
        begin
          return Integer(text, 10)
        rescue StandardError => e
          LOGGER.debug(e)
        end

        default
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
zakuro-0.7.2 lib/zakuro/tools/typeconv.rb
zakuro-0.7.0 lib/zakuro/tools/typeconv.rb
zakuro-0.6.1 lib/zakuro/tools/typeconv.rb
zakuro-0.6.0 lib/zakuro/tools/typeconv.rb