Class: SyoboiCalendar::Comment
- Inherits:
-
Object
- Object
- SyoboiCalendar::Comment
- Defined in:
- lib/syoboi_calendar/comment.rb
Constant Summary collapse
- PATTERN_SPLITTING_SECTIONS =
/\n{1,2}(?=\*(?!\*))/
Instance Attribute Summary collapse
- #source ⇒ String readonly
Instance Method Summary collapse
- #casts ⇒ Array<SyoboiCalendar::Personality>
- #comment_sections ⇒ Array<SyoboiCalendar::CommentSection>
-
#initialize(source) ⇒ Comment
constructor
A new instance of Comment.
- #songs_ending ⇒ Array<SyoboiCalendar::Song>
- #songs_inserted ⇒ Array<SyoboiCalendar::Song>
- #songs_opening ⇒ Array<SyoboiCalendar::Song>
- #songs_theme ⇒ Array<SyoboiCalendar::Song>
- #staffs ⇒ Array<SyoboiCalendar::Personality>
Constructor Details
#initialize(source) ⇒ Comment
Returns a new instance of Comment.
9 10 11 |
# File 'lib/syoboi_calendar/comment.rb', line 9 def initialize(source) @source = source end |
Instance Attribute Details
#source ⇒ String (readonly)
6 7 8 |
# File 'lib/syoboi_calendar/comment.rb', line 6 def source @source end |
Instance Method Details
#casts ⇒ Array<SyoboiCalendar::Personality>
14 15 16 17 18 19 20 |
# 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 ⇒ Array<SyoboiCalendar::CommentSection>
23 24 25 26 27 |
# 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 ⇒ Array<SyoboiCalendar::Song>
30 31 32 33 34 |
# 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 ⇒ Array<SyoboiCalendar::Song>
37 38 39 40 41 |
# 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 ⇒ Array<SyoboiCalendar::Song>
44 45 46 47 48 |
# 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 ⇒ Array<SyoboiCalendar::Song>
51 52 53 54 55 |
# 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 ⇒ Array<SyoboiCalendar::Personality>
58 59 60 61 62 63 64 |
# File 'lib/syoboi_calendar/comment.rb', line 58 def staffs if comment_section = comment_sections.find(&:about_staffs?) comment_section.personalities else [] end end |