Class: PlainText::Part::Boundary

Inherits:
String
  • Object
show all
Defined in:
lib/plain_text/part/boundary.rb

Overview

Class to express a Boundary as String

Constant Summary collapse

Empty =

Empty Boundary instance

self.new ""

Instance Method Summary collapse

Methods included from Split

count_lines, #count_lines, count_regexp, #count_regexp, #split_with_delimiter, split_with_delimiter

Instance Method Details

#inspectString



11
12
13
14
15
# File 'lib/plain_text/part/boundary.rb', line 11

def inspect
  # 'Boundary("\n\n\n")'
  s = self.class.name
  sprintf "%s(%s)", (s.split('::')[2..-1].join('::') rescue s), super
end

#subclass_nameString

Boundary sub-class name only

Make sure your class is a child class of Boundary. Otherwise this method would not be inherited, obviously.

Examples:

class PlainText::Part::Boundary
  class SubBoundary < self
    class SubBoundary < self; end  # It must be a child class!
  end
end
ss = PlainText::Part::SubBoundary::SubSubBoundary.new ["abc"]
ss.subclass_name  # => "SubBoundary::SubSubBoundary"

See Also:



33
34
35
36
# File 'lib/plain_text/part/boundary.rb', line 33

def subclass_name
  printf "__method__=(%s)\n", __method__
  self.class.name.split(/\A#{Regexp.quote method(__method__).owner.name}::/)[1] || ''
end