Class: Doing::Section

Inherits:
Object
  • 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+@\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

#to_sObject

Outputs section title



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

def to_s
  @title
end