class Itest5ch::Comment
Attributes
date[RW]
@!attribute date
@return [Time]
id[RW]
@!attribute id
@return [String]
mail[RW]
@!attribute mail
@return [String]
message[RW]
@!attribute message
@return [String]
name[RW]
@!attribute name
@return [String]
number[RW]
@!attribute number
@return [Integer]
thread[RW]
@!attribute thread
@return [Itest5ch::Thread]
Public Class Methods
new(number:, name:, mail:, date:, id:, message:, thread:)
click to toggle source
@param number [Integer] @param name [String] @param mail [String] @param date [Time] @param id [String] @param message [String] @param thread [Itest5ch::Thread]
# File lib/itest5ch/comment.rb, line 40 def initialize(number:, name:, mail:, date:, id:, message:, thread:) # rubocop:disable Metrics/ParameterLists @number = number @name = name @mail = mail @date = date @id = id @message = message @thread = thread end
Public Instance Methods
anchor_numbers()
click to toggle source
@return [Array<Integer>]
# File lib/itest5ch/comment.rb, line 51 def anchor_numbers numbers = message.scan(/[>>]+([0-90-9\-]+)/).map do |result| str = result.first.tr("0-9", "0-9") if (m = str.match(/([0-9]+)-([0-9]+)/)) (m[1].to_i..m[2].to_i).to_a else str.to_i end end numbers.flatten.compact end
Also aliased as: reply_numbers
id_checker_url()
click to toggle source
Get Id checker url for hissi.org
@return [String] @return [nil] {#id} is empty
@see hissi.org
# File lib/itest5ch/comment.rb, line 83 def id_checker_url return nil if !id || id.empty? ymd = date.strftime("%Y%m%d") encoded_id = Base64.strict_encode64(id).delete("=") "http://hissi.org/read.php/#{thread.board}/#{ymd}/#{encoded_id}.html" end
pc_url()
click to toggle source
@return [String]
# File lib/itest5ch/comment.rb, line 68 def pc_url "#{thread.pc_url}/#{number}" end
smartphone_url()
click to toggle source
@return [String]
# File lib/itest5ch/comment.rb, line 73 def smartphone_url "#{thread.smartphone_url}/#{number}" end