Sha256: 5d1b4de025bab42a98608cdb9312bc1f69cf6a1a6c4c77c63dbee9a838701c83

Contents?: true

Size: 1.59 KB

Versions: 2

Compression:

Stored size: 1.59 KB

Contents

module Peatio
  module Coinpaymentnew
    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))
            [
              "Coinpaymentnew blockchain version requirement was not satisfied by Peatio::Blockchain.",
              "Coinpaymentnew 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))
            [
              "Coinpaymentnew wallet version requirement was not satisfied by Peatio::Wallet.",
              "Coinpaymentnew 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[:coinpaymentnew] = Coinpaymentnew::Blockchain
          Peatio::Wallet.registry[:coinpaymentnewd] = Coinpaymentnew::Wallet
        end
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
peatio-coinpaymentnew-0.0.1 lib/peatio/coinpaymentnew/hooks.rb
peatio-coinpaymentnew-1.0.0 lib/peatio/coinpaymentnew/hooks.rb