module Jot::Ruby::Utils::Snippets

Public Instance Methods

gem_root() click to toggle source
# File lib/jot/ruby/utils/snippets.rb, line 16
def gem_root
  root = File.dirname(File.expand_path(caller_locations(1, 1)[0].path))
  while root != '/'
    return root unless Dir[File.join(root, '*.gemspec')].empty?
    root = File.dirname(root)
  end
  nil
end
not_implemented(*method_names) click to toggle source
# File lib/jot/ruby/utils/snippets.rb, line 5
def not_implemented(*method_names)
  not_implemented_module = Module.new do
    method_names.each do |method_name|
      define_method method_name do |*_args|
        raise NotImplementedError, method_name
      end
    end
  end
  include not_implemented_module
end