summaryrefslogtreecommitdiff
path: root/jni/ruby/lib/rdoc/markup/special.rb
blob: 1c0fc03eea5138a09798356296d1ca5ffd560cdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
##
# Hold details of a special sequence

class RDoc::Markup::Special

  ##
  # Special type

  attr_reader   :type

  ##
  # Special text

  attr_accessor :text

  ##
  # Creates a new special sequence of +type+ with +text+

  def initialize(type, text)
    @type, @text = type, text
  end

  ##
  # Specials are equal when the have the same text and type

  def ==(o)
    self.text == o.text && self.type == o.type
  end

  def inspect # :nodoc:
    "#<RDoc::Markup::Special:0x%x @type=%p, @text=%p>" % [
      object_id, @type, text.dump]
  end

  def to_s # :nodoc:
    "Special: type=#{type} text=#{text.dump}"
  end

end