Sha256: 86558eba4ed79d7d33c0b8c74c740a7dfc9179712e63bb01c530bad1d3dd71d9

Contents?: true

Size: 1.46 KB

Versions: 2

Compression:

Stored size: 1.46 KB

Contents

module Peatio
  module Ndex
    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))
            [
              "Ndex blockchain version requiremnt was not suttisfied by Peatio::Blockchain.",
              "Ndex 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))
            [
              "Ndex wallet version requiremnt was not suttisfied by Peatio::Wallet.",
              "Ndex 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[:ndex] = Ndex::Blockchain.new
          Peatio::Wallet.registry[:ndexd] = Ndex::Wallet.new
        end
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
peatio-ndex-0.2.2 lib/peatio/ndex/hooks.rb
peatio-ndex-0.2.1 lib/peatio/ndex/hooks.rb