= Conference.new("RubyConf 2020") # conf.talks << talk1 # conf.talks << talk2 # class Conference # The name of the conference. attr_reader name: String # Talks of the conference. attr_reader talks: Array[Talk] def initialize: (String name) -> void # Yields all speakers of the conference. # Deduped, and no order guaranteed. def each_speaker: { (Speaker) -> void } -> void | () -> Enumerator[Speaker, void] end
each_speaker(&block) # @type var speakers: Array[Speak speakers = [] talks.each do |talk| speakers << talk.speaker end speakers.each(&block) end end class Conference def each_speaker: { (Speaker) -> void } -> void end
'VSS"O'PTUFS)JDLT w +VTUJO5JNF4UBUJD5ZQF$IFDLJOHGPS%ZOBNJD-BOHVBHFT 3FO'PTUFS w 1SPHSFTTSFQPSU3VCZʹ͓͚Δ੩తܕղੳͷ࣮ݱʹ͚ͯ ԕ౻দຊ্ॅҪদຊ w 4PSCFUIUUQTTPSCFUPSH w 4UFFQIUUQTHJUIVCDPNTPVUBSPTUFFQ w 3#4IUUQTHJUIVCDPNSVCZSCT w 5ZQF1SPGIUUQTHJUIVCDPNNBNFUZQFQSPG w HFN@SCT@DPMMFDUJPOIUUQTHJUIVCDPNSVCZHFN@SCT@DPMMFDUJPO