Sha256: ab4780ee2f963b462ef7f50f624bacc5312e66240be7019281e642cb6be68134

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
peatio-litecoin-2.4.0 lib/peatio/litecoin/hooks.rb
peatio-litecoin-0.2.1.pre.alpha lib/peatio/litecoin/hooks.rb
peatio-litecoin-0.2.0 lib/peatio/litecoin/hooks.rb