Sha256: cda88639050eb000aee04a86475ebe63669f3e51b9773f974c66c33d8434441f

Contents?: true

Size: 1.48 KB

Versions: 6

Compression:

Stored size: 1.48 KB

Contents

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

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

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
peatio-nexbit-0.1.5 lib/peatio/nexbit/hooks.rb
peatio-ndc-0.1.2 lib/peatio/ndc/hooks.rb
peatio-nexbit-0.1.4 lib/peatio/nexbit/hooks.rb
peatio-nexbit-0.1.3 lib/peatio/nexbit/hooks.rb
peatio-nexbit-0.1.2a lib/peatio/nexbit/hooks.rb
peatio-nexbit-0.1.2 lib/peatio/nexbit/hooks.rb