░▒▓████████████████████████████████▓▒░ ░▒▓█ ▓▒░ ░▒▓█ ~ S W A M P ~ ▓▒░ ░▒▓█ ▓▒░ ░▒▓████████████████████████████████▓▒░
pplmvsvm
LOCATION:
/var/www/canvas/vendor/bundle/ruby/3.1.0/gems/dig_rb-1.0.1/lib/dig_rb
☗ ROOT
↻ REFRESH
✎ CARVE FLESH
EDITING: struct.rb
unless Struct.instance_methods.include?(:dig) Struct.class_eval do # Extracts the nested value specified by the sequence of <i>idx</i> # objects by calling +dig+ at each step, returning +nil+ if any # intermediate step is +nil+. # klass = Struct.new(:a) # o = klass.new(klass.new({b: [1, 2, 3]})) # o.dig(:a, :a, :b, 0) #=> 1 # o.dig(:b, 0) #=> nil def dig(name, *args) begin name = name.to_sym rescue NoMethodError raise TypeError, "#{name} is not a symbol nor a string" end return nil unless self.respond_to?(name) value = self.send(name) return value if args.length == 0 || value.nil? DigRb.guard_dig(value) value.dig(*args) end end end
CANCEL
Name
Type
Size
Modified
Actions
↩ ..
DIR
—
—
📄 array.rb
RB
241 B
2023-09-24 03:47
EDIT
📄 hash.rb
RB
465 B
2023-09-24 03:47
EDIT
📄 ostruct.rb
RB
822 B
2023-09-24 03:47
EDIT
📄 struct.rb
RB
793 B
2023-09-24 03:47
EDIT
📄 version.rb
RB
37 B
2023-09-24 03:47
EDIT