Linux lorencats.com 5.10.103-v7l+ #1529 SMP Tue Mar 8 12:24:00 GMT 2022 armv7l
Apache/2.4.59 (Raspbian)
: 10.0.0.29 | : 216.73.216.130
Cant Read [ /etc/named.conf ]
7.3.31-1~deb10u7
root
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
usr /
lib /
ruby /
vendor_ruby /
hashery /
[ HOME SHELL ]
Name
Size
Permission
Action
association.rb
4.58
KB
-rw-r--r--
casting_hash.rb
3.27
KB
-rw-r--r--
core_ext.rb
2.57
KB
-rw-r--r--
crud_hash.rb
8.64
KB
-rw-r--r--
dictionary.rb
12.46
KB
-rw-r--r--
fuzzy_hash.rb
3.94
KB
-rw-r--r--
ini_hash.rb
8.08
KB
-rw-r--r--
key_hash.rb
1.47
KB
-rw-r--r--
linked_list.rb
4.47
KB
-rw-r--r--
lru_hash.rb
5.6
KB
-rw-r--r--
open_cascade.rb
3.95
KB
-rw-r--r--
open_hash.rb
3.5
KB
-rw-r--r--
ordered_hash.rb
3.18
KB
-rw-r--r--
path_hash.rb
6.82
KB
-rw-r--r--
property_hash.rb
3.53
KB
-rw-r--r--
query_hash.rb
2.19
KB
-rw-r--r--
stash.rb
203
B
-rw-r--r--
static_hash.rb
1.24
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : casting_hash.rb
require 'hashery/crud_hash' module Hashery # CastingHash is just like CRUDHash, except that both keys and values # can be passed through casting procedures. # class CastingHash < CRUDHash # # Like `#new` but can take a priming Hash or Array-pairs. # # hash - Hash-like object. # # Examples # # CastingHash[:a,1,:b,2] # # Returns `CastingHash`. # def self.[](hash) s = new hash.each{ |k,v| s[k] = v } s end # # Unlike traditional Hash a CastingHash's block argument # coerces key/value pairs when #store is called. # # default - Default value. # cast_proc - Casting procedure. # def initialize(default=nil, &cast_proc) @cast_proc = cast_proc super(default, &nil) end # # The cast procedure. # # proc - Casting procedure. # # Returns `Proc` used for casting. # def cast_proc(&proc) @cast_proc = proc if proc @cast_proc end # # Set `cast_proc`. This procedure must take two arguments (`key, value`) # and return the same. # # proc - Casting procedure. # # Returns +proc+. # def cast_proc=(proc) raise ArgumentError unless Proc === proc or NilClass === proc @cast_proc = proc end # # CRUD method for create and update. Unlike the parent class # the key, value pair are passed threw the cast_proc before # being set in the underlying hash table. # # key - Key of entry. # value - Value of entry. # # Returns the +value+. # def store(key, value) super(*cast_pair(key, value)) end # # Replace current entries with those from another Hash, # or Hash-like object. Each entry is run through the # casting procedure as it is added. # # other - Hash-like object. # # Returns +self+. # def replace(other) super cast(other) end # # Convert the CastingHash to a regular Hash. # # Returns an ordinary `Hash`. # def to_hash h = {}; each{ |k,v| h[k] = v }; h end # # Returns an ordinary `Hash`. # alias_method :to_h, :to_hash # # Recast all entries via the cast procedure. # # TODO: Isn't this the same as `#rehash`? # # Returns +self+. # def recast! replace self end private # # If `cast_proc` is defined then use it to process key-value pair, # otherwise return them as is. # # key - Key of entry. # value - Value of entry. # # Returns `Array` of key-value pair. # def cast_pair(key, value) if cast_proc return cast_proc.call(key, value) else return key, value end end # # Cast a given +hash+ according to the `#key_proc` and `#value_proc`. # # hash - A `Hash` or anything the responds to `#each` like a hash. # # Returns a recasted `Hash`. # def cast(hash) h = {} hash.each do |k,v| k, v = cast_pair(k, v) h[k] = v end h end end end # TODO: Should we add #to_casting_hash to Hash classs? #class Hash # # # Convert a Hash to a CastingHash. # def to_casting_hash(value_cast=nil, &key_cast) # CastingHash.new(self, value_cast, &key_cast) # end # #end
Close