Class: Obp::Access::Renderer::Elements::SectionTitle

Inherits:
Object
  • Object
show all
Defined in:
lib/obp/access/elements/section_title.rb

Constant Summary collapse

LABEL_PATTERN =
/\A(\d+(?:\.\d+)*)\s{2,}/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_text) ⇒ SectionTitle

Returns a new instance of SectionTitle.



12
13
14
15
16
17
18
19
20
21
# File 'lib/obp/access/elements/section_title.rb', line 12

def initialize(raw_text)
  match = raw_text.match(LABEL_PATTERN)
  if match
    @label = match[1]
    @text = raw_text[match[0].length..].strip
  else
    @label = nil
    @text = raw_text.strip
  end
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



10
11
12
# File 'lib/obp/access/elements/section_title.rb', line 10

def label
  @label
end

#textObject (readonly)

Returns the value of attribute text.



10
11
12
# File 'lib/obp/access/elements/section_title.rb', line 10

def text
  @text
end