class Syobocal::Comment::Person

Constants

ENCODED_SEPARATOR
PERSON_SEPARATOR

Attributes

name[R]
note[R]

Public Class Methods

multi_parse(str) click to toggle source
# File lib/syobocal/comment/person.rb, line 23
def self.multi_parse(str)
  Helper::Fragment.parse(str).to_a.map{|f|
    name = f.text
    note = f&.child&.to_s

    Person.new(name, note)
  }
end
new(name, note) click to toggle source
# File lib/syobocal/comment/person.rb, line 9
def initialize(name, note)
  @name, @note = name, note
end
parse(str) click to toggle source
# File lib/syobocal/comment/person.rb, line 17
def self.parse(str)
  _, name, note = *(str.match(/\A([^\(\)]+?)(?:\((.*?)\))?\Z/).to_a)

  Person.new(name, note)
end

Public Instance Methods

==(other) click to toggle source
# File lib/syobocal/comment/person.rb, line 13
def ==(other)
  other.instance_of?(self.class) && other.name == name && other.note == note
end