ruby-uebungen/Assignment_040/solution
Thomas Smits 25d5ac7ffd Initial commit 2023-05-23 09:19:31 +02:00
..
readme.md Initial commit 2023-05-23 09:19:31 +02:00

readme.md

Lösung: Eigenclass einer Klasse

















































































```ruby class Numeric class << self def to_binary(n) n.to_s(2) end end end

puts Numeric::to_binary(47)


Alternative Lösung:

```ruby
class << Numeric
  def to_binary(n)
    n.to_s(2)
  end
end

puts Numeric::to_binary(47)