/usr/lib/ruby/vendor_ruby/librarian/source/basic_api.rb is in ruby-librarian 0.1.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | module Librarian
module Source
module BasicApi
def self.included(base)
base.extend ClassMethods
class << base
def lock_name(name)
def_sclass_prop(:lock_name, name)
end
def spec_options(keys)
def_sclass_prop(:spec_options, keys)
end
private
def def_sclass_prop(name, arg)
sclass = class << self ; self ; end
sclass.module_exec do
remove_method(name)
define_method(name) { arg }
end
end
end
end
module ClassMethods
def from_lock_options(environment, options)
new(environment, options[:remote], options.reject{|k, v| k == :remote})
end
def from_spec_args(environment, param, options)
recognized_options = spec_options
unrecognized_options = options.keys - recognized_options
unrecognized_options.empty? or raise Error,
"unrecognized options: #{unrecognized_options.join(", ")}"
new(environment, param, options)
end
end
end
end
end
|