Sha256: eefba2beb2f78e3ed31970dee57744b0d2885d4e0849dfc45b6d4bd049e57bca
Contents?: true
Size: 792 Bytes
Versions: 9
Compression:
Stored size: 792 Bytes
Contents
module Fasterer class RescueCall attr_reader :element attr_reader :rescue_classes def initialize(element) @element = element @rescue_classes = [] set_rescue_classes end private def set_rescue_classes return if element[1].sexp_type != :array @rescue_classes = element[1].drop(1).map do |rescue_reference| if rescue_reference.sexp_type == :const rescue_reference[1] end end.compact end def set_multiple_rescue_classes @rescue_classes = element[1].drop(1).map do |rescue_reference| rescue_reference.flatten[2] end end def set_single_rescue_class if element[1][0][0] == :var_ref @rescue_classes = Array(element[1][0][1][1]) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems