Sha256: 90dbca6129345a0c0e9fb85f9ea231df1a913af3a5c8a5ebb8c39d03cf792721

Contents?: true

Size: 661 Bytes

Versions: 1

Compression:

Stored size: 661 Bytes

Contents

module Jot
  module Ruby
    module Utils
      module Snippets
        def not_implemented(*method_names)
          include Module.new do
            method_names.each do |method_name|
              define_method method_name do |*_args|
                raise NotImplementedError, method_name
              end
            end
          end
        end

        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
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jot-ruby-0.1.3 lib/jot/ruby/utils/snippets.rb