Socket
Book a DemoInstallSign in
Socket

dry-importer

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dry-importer

0.0.1
bundlerRubygems
Version published
Maintainers
1
Created
Source

dry-importer Join the chat at https://gitter.im/dryrb/chat

Gem Version Build Status Dependency Status Code Climate Documentation Status

Import a constant tree into another

Synopsis

module BaseLibrary
  class SomeClass
    def self.base_method
      'base'
    end
  end

  class Tool
    def self.get_base_method
      namespace::SomeClass.base_method
    end

    private

    def self.namespace
      Module.const_get(self.to_s[/(.*)(?=::)/])
    end
  end
end

module ExtensionLibrary
  Dry::Importer.import(self, BaseLibrary)

  class SomeClass
    def self.base_method
      "was #{super}"
    end
  end
end

BaseLibrary::Tool.get_base_method
# => "base"
ExtensionLibrary::Tool.get_base_method
# => "was base"

License

See LICENSE file.

FAQs

Package last updated on 26 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.