https://howhttps.works/

https privacy integrity identification

class MyNumber attr_reader :value

def initialize(value) @value = value end

Define or override the + operator

def +(other) MyNumber.new(self.value + other.value) end

def to_s ”$#{value}” end end

a = MyNumber.new(2) b = MyNumber.new(4) c = a + b

puts c # Outputs: $6

in ruby a string with signle quest does not support interepolation(#{x}).

i laso know abbout String.swapcase , which swap the cases of string.

what is block? does blocks are object? doest it associate to any object?

how to extract a method as proc on ruby? A= class Calculator def add(a, b) return a + b end end

addition_method = Calculator.new.method(“add”) addition = addition_method.to_proc

puts addition.call(5, 6)