JoshCheek / seeing_is_believing

Displays the results of every line of code in your file
1.31k stars 54 forks source link

Refinement didn't work #128

Closed JoshCheek closed 6 years ago

JoshCheek commented 6 years ago

Not sure if it should, but I'll drop this here to remind myself to look into it later. Note that I did try to use it this way, so maybe this should have been correct.

module BinMeUp
  refine Fixnum do
    def inspect
      "%08b" % self  # => "01111011"
    end              # => :inspect
  end                # => #<refinement:Integer@BinMeUp>
end                  # => #<refinement:Integer@BinMeUp>

using BinMeUp  # => main

123          # => 123
123.inspect  # => "01111011"