File: nenv.rb

package info (click to toggle)
ruby-nenv 0.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 180 kB
  • sloc: ruby: 517; sh: 4; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 498 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require 'nenv/version'

require 'nenv/autoenvironment'
require 'nenv/builder'

def Nenv(namespace = nil)
  Nenv::AutoEnvironment.new(namespace).tap do |env|
    yield env if block_given?
  end
end

module Nenv
  class << self
    def respond_to?(meth)
      instance.respond_to?(meth)
    end

    def method_missing(meth, *args)
      instance.send(meth, *args)
    end

    def reset
      @instance = nil
    end

    def instance
      @instance ||= Nenv::AutoEnvironment.new
    end
  end
end