Sha256: 8fed9cf37797ef7889259e57235dbc13094900aa10572b83f806effd4a50f4b0

Contents?: true

Size: 1.53 KB

Versions: 2

Compression:

Stored size: 1.53 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[:goldcashcash] = Goldcash::Blockchain
          Peatio::Wallet.registry[:goldcashcashd] = Goldcash::Wallet
        end
      end

      if defined?(Rails::Railtie)
        require "peatio/goldcashcash/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.1 lib/peatio/goldcash/hooks.rb
peatio-goldcash-2.6.7 lib/peatio/goldcash/hooks.rb