Sha256: adfc6968f312b6c26e8622739ac0fcf6356bbbaec2f8df05d021131ac0c3fefd
Contents?: true
Size: 694 Bytes
Versions: 38
Compression:
Stored size: 694 Bytes
Contents
# # class Comment # Management a comment. # module TDiary class Comment attr_reader :name, :mail, :body, :date def initialize( name, mail, body, date = Time::now ) @name, @mail, @body, @date = name, mail, body, date @show = true end def shorten( length = 120 ) matched = body.gsub( /\n/, ' ' ).scan( /^.{0,#{length - 2}}/u )[0] unless $'.empty? then matched + '..' else matched end end def visible?; @show; end def show=( s ); @show = s; end def ==( c ) (@name == c.name) and (@mail == c.mail) and (@body == c.body) end end end # Local Variables: # mode: ruby # indent-tabs-mode: t # tab-width: 3 # ruby-indent-level: 3 # End: # vim: ts=3
Version data entries
38 entries across 28 versions & 1 rubygems