Class: PlainText::Part::Paragraph
- Defined in:
- lib/plain_text/part/paragraph.rb
Overview
Class to express a Paragraph as String
Constant Summary collapse
- Empty =
Empty Paragraph instance
self.new ""
Instance Method Summary collapse
- #inspect ⇒ String
-
#subclass_name ⇒ String
Paragraph sub-class name.
Methods included from Split
split_with_delimiter, #split_with_delimiter
Instance Method Details
#inspect ⇒ String
11 12 13 14 15 |
# File 'lib/plain_text/part/paragraph.rb', line 11 def inspect # 'Paragraph("abc\ndef")' or like 'Paragraph::Title("My Title")' s = self.class.name sprintf "%s(%s)", (s.split('::')[2..-1].join('::') rescue s), super end |
#subclass_name ⇒ String
Paragraph sub-class name
Make sure your class is a child class of Paragraph. Otherwise this method would not be inherited, obviously.
24 25 26 27 |
# File 'lib/plain_text/part/paragraph.rb', line 24 def subclass_name printf "__method__=(%s)\n", __method__ self.class.name.split(/\A#{Regexp.quote method(__method__).owner.name}::/)[1] || '' end |