R
Ralph Shnelvar
Newbie here.
Consider the following two "say" methods.
irb(main):020:0> class Test2
irb(main):021:1> def self.say(block)
irb(main):022:2> block.call(self.class)
irb(main):023:2> end
irb(main):024:1> def say(block)
irb(main):025:2> block.call(self.class)
irb(main):026:2> end
irb(main):027:1> end
=> nil
irb(main):028:0> Test2.new.say(c)
Test2
=> nil
irb(main):029:0> Test2.say(c)
Class
(1) Do I have the nomenclature correct? Are the two "say" methods a class
and instance method?
(2) Is this valid Ruby both stylistically and semantically?
Consider the following two "say" methods.
irb(main):020:0> class Test2
irb(main):021:1> def self.say(block)
irb(main):022:2> block.call(self.class)
irb(main):023:2> end
irb(main):024:1> def say(block)
irb(main):025:2> block.call(self.class)
irb(main):026:2> end
irb(main):027:1> end
=> nil
irb(main):028:0> Test2.new.say(c)
Test2
=> nil
irb(main):029:0> Test2.say(c)
Class
(1) Do I have the nomenclature correct? Are the two "say" methods a class
and instance method?
(2) Is this valid Ruby both stylistically and semantically?