/usr/lib/ruby/vendor_ruby/sequel/extensions/hash_aliases.rb is in ruby-sequel 4.1.1-1.
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 | # The hash_aliases extension allows Dataset#select and Dataset#from
# to treat a hash argument as an alias specification, with keys
# being the expressions and values being the aliases,
# which was the historical behavior before Sequel 4.
# It is only recommended to use this for backwards compatibility.
#
# You can load this extension into specific datasets:
#
# ds = DB[:table]
# ds.extension(:hash_aliases)
#
# Or you can load it into all of a database's datasets, which
# is probably the desired behavior if you are using this extension:
#
# DB.extension(:hash_aliases)
module Sequel
module HashAliases
def from(*source)
super(*convert_hash_aliases(source))
end
def select(*columns, &block)
virtual_row_columns(columns, block)
super(*convert_hash_aliases(columns), &nil)
end
private
def convert_hash_aliases(columns)
m = []
columns.each do |i|
if i.is_a?(Hash)
m.concat(i.map{|k, v| SQL::AliasedExpression.new(k,v)})
else
m << i
end
end
m
end
end
Dataset.register_extension(:hash_aliases, HashAliases)
end
|