Here are my solutions.
class Greeting
def initialize(thing)
@thing = thing
end
def inspect
“#{self.class}, #{@thing}”
end
alias to_s inspect
def self.method_missing(method)
new(method)
end
end
def Object.const_missing(const)
const_set(const, Class.new(Greeting))
end
def method_missing(arg)
“#{arg}\n”
end
$, = ", "
$stderr = $stdout
p Hello.new(:world!)
puts Hello[:world!]
warn Hello.world!
print Hello, world!
print [Hello, world!]
hash = { Hello => :world! }
puts hash