Skip to content

Instantly share code, notes, and snippets.

@matthewd
Created November 26, 2010 16:01
Show Gist options
  • Select an option

  • Save matthewd/716885 to your computer and use it in GitHub Desktop.

Select an option

Save matthewd/716885 to your computer and use it in GitHub Desktop.
"%*1$.*2$3$d"
0000: push_local 2 # 3$
0002: push_const_fast :Kernel, 1
0005: swap_stack
0006: send_stack :Integer, 1
0009: send_method :to_s
0011: push_const_fast :Kernel, 4
0014: push_local 1 # 2$
0016: send_stack :Integer, 1
0019: dup_top
0020: push_const_fast :Fixnum, 6
0023: swap_stack
0024: kind_of
0025: goto_if_true 36
0027: push_const_fast :ArgumentError, 8
0030: push_literal "precision too big"
0032: send_stack :new, 1
0035: raise_exc
0036: push_literal "0"
0038: send_stack :rjust, 2
0041: push_const_fast :Kernel, 13
0044: push_local 0 # 1$
0046: send_stack :Integer, 1
0049: dup_top
0050: push_const_fast :Fixnum, 14
0053: swap_stack
0054: kind_of
0055: goto_if_true 66
0057: push_const_fast :ArgumentError, 15
0060: push_literal "width too big"
0062: send_stack :new, 1
0065: raise_exc
0066: dup_top
0067: meta_push_0
0068: meta_send_op_lt :<
0070: goto_if_true 77
0072: send_stack :rjust, 1
0075: goto 84
0077: meta_push_0
0078: swap_stack
0079: meta_send_op_minus :-
0081: send_stack :ljust, 1
0084: string_dup
0085: ret
"%1$s %2$s %1$s %2$s"
0000: push_local 0 # 1$
0002: dup_top
0003: send_method :to_s
0005: string_dup
0006: swap_stack
0007: send_method :tainted?
0009: goto_if_false 13
0011: send_method :taint
0013: push_literal " "
0015: swap_stack
0016: string_append
0017: push_local 1 # 2$
0019: dup_top
0020: send_method :to_s
0022: swap_stack
0023: move_down 2
0025: swap_stack
0026: string_append
0027: swap_stack
0028: send_method :tainted?
0030: goto_if_false 34
0032: send_method :taint
0034: push_literal " "
0036: swap_stack
0037: string_append
0038: push_local 0 # 1$
0040: dup_top
0041: send_method :to_s
0043: swap_stack
0044: move_down 2
0046: swap_stack
0047: string_append
0048: swap_stack
0049: send_method :tainted?
0051: goto_if_false 55
0053: send_method :taint
0055: push_literal " "
0057: swap_stack
0058: string_append
0059: push_local 1 # 2$
0061: dup_top
0062: send_method :to_s
0064: swap_stack
0065: move_down 2
0067: swap_stack
0068: string_append
0069: swap_stack
0070: send_method :tainted?
0072: goto_if_false 76
0074: send_method :taint
0076: ret
"%p %p"
0000: push_local 0 #
0002: send_method :inspect
0004: dup_top
0005: string_dup
0006: swap_stack
0007: send_method :tainted?
0009: goto_if_false 13
0011: send_method :taint
0013: push_literal " "
0015: swap_stack
0016: string_append
0017: push_local 1 #
0019: send_method :inspect
0021: dup_top
0022: swap_stack
0023: move_down 2
0025: swap_stack
0026: string_append
0027: swap_stack
0028: send_method :tainted?
0030: goto_if_false 34
0032: send_method :taint
0034: push_rubinius
0035: find_const :Globals
0037: push_literal :$DEBUG
0039: send_stack :[], 1
0042: goto_if_false 60
0044: push_local 2 # splat
0046: send_method :empty?
0048: goto_if_true 60
0050: pop
0051: push_const_fast :ArgumentError, 9
0054: push_literal "too many arguments for format string"
0056: send_stack :new, 1
0059: raise_exc
0060: ret
"%*.*f"
0000: push_local 2 #
0002: push_const_fast :Kernel, 1
0005: swap_stack
0006: send_stack :Float, 1
0009: dup_top
0010: send_method :finite?
0012: goto_if_false 85
0014: push_literal "f"
0016: push_const_fast :Kernel, 5
0019: push_local 1 #
0021: send_stack :Integer, 1
0024: dup_top
0025: push_const_fast :Fixnum, 8
0028: swap_stack
0029: kind_of
0030: goto_if_true 41
0032: push_const_fast :ArgumentError, 10
0035: push_literal "precision too big"
0037: send_stack :new, 1
0040: raise_exc
0041: send_method :to_s
0043: push_literal "."
0045: push_const_fast :Kernel, 15
0048: push_local 0 #
0050: send_stack :Integer, 1
0053: dup_top
0054: push_const_fast :Fixnum, 16
0057: swap_stack
0058: kind_of
0059: goto_if_true 70
0061: push_const_fast :ArgumentError, 17
0064: push_literal "width too big"
0066: send_stack :new, 1
0069: raise_exc
0070: send_method :to_s
0072: push_literal "%"
0074: string_dup
0075: string_append
0076: string_append
0077: string_append
0078: string_append
0079: allow_private
0080: send_stack :to_s_formatted, 1
0083: goto 150
0085: dup_top
0086: send_method :nan?
0088: goto_if_true 104
0090: meta_push_0
0091: send_stack :<, 1
0094: goto_if_true 100
0096: push_literal "Inf"
0098: goto 107
0100: push_literal "-Inf"
0102: goto 107
0104: pop
0105: push_literal "NaN"
0107: push_const_fast :Kernel, 26
0110: push_local 0 #
0112: send_stack :Integer, 1
0115: dup_top
0116: push_const_fast :Fixnum, 27
0119: swap_stack
0120: kind_of
0121: goto_if_true 132
0123: push_const_fast :ArgumentError, 28
0126: push_literal "width too big"
0128: send_stack :new, 1
0131: raise_exc
0132: dup_top
0133: meta_push_0
0134: meta_send_op_lt :<
0136: goto_if_true 143
0138: send_stack :rjust, 1
0141: goto 150
0143: meta_push_0
0144: swap_stack
0145: meta_send_op_minus :-
0147: send_stack :ljust, 1
0150: string_dup
0151: push_rubinius
0152: find_const :Globals
0154: push_literal :$DEBUG
0156: send_stack :[], 1
0159: goto_if_false 177
0161: push_local 3 # splat
0163: send_method :empty?
0165: goto_if_true 177
0167: pop
0168: push_const_fast :ArgumentError, 36
0171: push_literal "too many arguments for format string"
0173: send_stack :new, 1
0176: raise_exc
0177: ret
"%05f"
0000: push_local 0 #
0002: push_const_fast :Kernel, 1
0005: swap_stack
0006: send_stack :Float, 1
0009: dup_top
0010: send_method :finite?
0012: goto_if_false 22
0014: push_literal "%05f"
0016: allow_private
0017: send_stack :to_s_formatted, 1
0020: goto 49
0022: dup_top
0023: send_method :nan?
0025: goto_if_true 41
0027: meta_push_0
0028: send_stack :<, 1
0031: goto_if_true 37
0033: push_literal "Inf"
0035: goto 44
0037: push_literal "-Inf"
0039: goto 44
0041: pop
0042: push_literal "NaN"
0044: push_literal 5
0046: send_stack :rjust, 1
0049: string_dup
0050: push_rubinius
0051: find_const :Globals
0053: push_literal :$DEBUG
0055: send_stack :[], 1
0058: goto_if_false 76
0060: push_local 1 # splat
0062: send_method :empty?
0064: goto_if_true 76
0066: pop
0067: push_const_fast :ArgumentError, 18
0070: push_literal "too many arguments for format string"
0072: send_stack :new, 1
0075: raise_exc
0076: ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment