Method: Paragraph#initialize
- Defined in:
- lib/tdiary/io/pstore.rb
#initialize(fragment, author = nil) ⇒ Paragraph
Returns a new instance of Paragraph.
98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/tdiary/io/pstore.rb', line 98 def initialize( fragment, = nil ) = lines = fragment.split( /\n+/ ) if lines.size > 1 then if /^<</ =~ lines[0] @subtitle = lines.shift.chomp.sub( /^</, '' ) elsif /^[ <]/u !~ lines[0] @subtitle = lines.shift.chomp end end @body = lines.join( "\n" ) end |