Sha256: 530c815188c769b0434bf6f81aa24d3cb998a5f071a05a347238f40413eb9af8

Contents?: true

Size: 1.52 KB

Versions: 2

Compression:

Stored size: 1.52 KB

Contents

# frozen_string_literal: true

module Peatio
  module Goldcash
    module Hooks
      BLOCKCHAIN_VERSION_REQUIREMENT = "~> 1.0.0"
      WALLET_VERSION_REQUIREMENT = "~> 1.0.0"

      class << self
        def check_compatibility
          unless Gem::Requirement.new(BLOCKCHAIN_VERSION_REQUIREMENT)
                                 .satisfied_by?(Gem::Version.new(Peatio::Blockchain::VERSION))
            [
              "Goldcash blockchain version requiremnt was not suttisfied by Peatio::Blockchain.",
              "Goldcash blockchain requires #{BLOCKCHAIN_VERSION_REQUIREMENT}.",
              "Peatio::Blockchain version is #{Peatio::Blockchain::VERSION}"
            ].join('\n').tap {|s| Kernel.abort s }
          end

          unless Gem::Requirement.new(WALLET_VERSION_REQUIREMENT)
                                 .satisfied_by?(Gem::Version.new(Peatio::Wallet::VERSION))
            [
              "Goldcash wallet version requiremnt was not suttisfied by Peatio::Wallet.",
              "Goldcash wallet requires #{WALLET_VERSION_REQUIREMENT}.",
              "Peatio::Wallet version is #{Peatio::Wallet::VERSION}"
            ].join('\n').tap {|s| Kernel.abort s }
          end
        end

        def register
          Peatio::Blockchain.registry[:goldcash] = Goldcash::Blockchain
          Peatio::Wallet.registry[:goldcashd] = Goldcash::Wallet
        end
      end

      if defined?(Rails::Railtie)
        require "peatio/goldcash/railtie"
      else
        check_compatibility
        register
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
peatio-gold-2.6.2 lib/peatio/goldcash/hooks.rb
peatio-goldcash-2.6.8 lib/peatio/goldcash/hooks.rb