class SyoboiCalendar::Comment

Constants

PATTERN_SPLITTING_SECTIONS

Attributes

source[R]

@return [String]

Public Class Methods

new(source) click to toggle source

@param source [String]

# File lib/syoboi_calendar/comment.rb, line 9
def initialize(source)
  @source = source
end

Public Instance Methods

casts() click to toggle source

@return [Array<SyoboiCalendar::Personality>]

# File lib/syoboi_calendar/comment.rb, line 14
def casts
  if comment_section = comment_sections.find(&:about_casts?)
    comment_section.personalities
  else
    []
  end
end
comment_sections() click to toggle source

@return [Array<SyoboiCalendar::CommentSection>]

# File lib/syoboi_calendar/comment.rb, line 23
def comment_sections
  source.split(PATTERN_SPLITTING_SECTIONS).map do |comment_section_source|
    ::SyoboiCalendar::CommentSection.new(comment_section_source)
  end
end
songs_ending() click to toggle source

@return [Array<SyoboiCalendar::Song>]

# File lib/syoboi_calendar/comment.rb, line 30
def songs_ending
  comment_sections.select(&:about_song_ending?).map do |comment_section|
    ::SyoboiCalendar::Song.new(comment_section.song_attributes)
  end
end
songs_inserted() click to toggle source

@return [Array<SyoboiCalendar::Song>]

# File lib/syoboi_calendar/comment.rb, line 37
def songs_inserted
  comment_sections.select(&:about_song_inserted?).map do |comment_section|
    ::SyoboiCalendar::Song.new(comment_section.song_attributes)
  end
end
songs_opening() click to toggle source

@return [Array<SyoboiCalendar::Song>]

# File lib/syoboi_calendar/comment.rb, line 44
def songs_opening
  comment_sections.select(&:about_song_opening?).map do |comment_section|
    ::SyoboiCalendar::Song.new(comment_section.song_attributes)
  end
end
songs_theme() click to toggle source

@return [Array<SyoboiCalendar::Song>]

# File lib/syoboi_calendar/comment.rb, line 51
def songs_theme
  comment_sections.select(&:about_song_theme?).map do |comment_section|
    ::SyoboiCalendar::Song.new(comment_section.song_attributes)
  end
end
staffs() click to toggle source

@return [Array<SyoboiCalendar::Personality>]

# File lib/syoboi_calendar/comment.rb, line 58
def staffs
  if comment_section = comment_sections.find(&:about_staffs?)
    comment_section.personalities
  else
    []
  end
end