Sha256: e838ecca0b6c1aecca96d4cc076b3e8ecdc44477f23293d5273b2e5103a0adc0

Contents?: true

Size: 650 Bytes

Versions: 1

Compression:

Stored size: 650 Bytes

Contents

require 'rib/shell'

module Rib
  module_function
  def config
    @config ||= {:config => '~/.config/rib/config.rb'}
  end

  def shells
    @shells ||= []
  end

  def vars
    @vars   ||= {}
  end

  def shell
    shells.last || begin
      require_rc
      (shells << Shell.new(config)).last
    end
  end

  def plugins
    Shell.ancestors[1..-1].select{ |a| a < Plugin }
  end

  def disable_plugins plugs=plugins
    plugs.each(&:disable)
  end

  def enable_plugins plugs=plugins
    plugs.each(&:enable)
  end

  def require_rc
    config[:config] &&
      File.exist?(rc = File.expand_path(config[:config])) &&
      require(rc)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rib-0.1.0 lib/rib.rb