Class: Doing::Section

Inherits:
Object show all
Defined in:
lib/doing/section.rb

Overview

Section Object

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, original: nil) ⇒ Section

Returns a new instance of Section.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/doing/section.rb', line 8

def initialize(title, original: nil)
  super()

  @title = title

  @original = if original.nil?
                "#{title}:"
              else
                original =~ /:(\s+@[^ (]+(\([^)]*\))?)*?$/ ? original : "#{original}:"
              end
end

Instance Attribute Details

#originalObject

Returns the value of attribute original.



6
7
8
# File 'lib/doing/section.rb', line 6

def original
  @original
end

#titleObject

Returns the value of attribute title.



6
7
8
# File 'lib/doing/section.rb', line 6

def title
  @title
end

Instance Method Details

#equal?(other) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/doing/section.rb', line 20

def equal?(other)
  @title == other.title
end

#to_sObject

Outputs section title



25
26
27
# File 'lib/doing/section.rb', line 25

def to_s
  @title
end