Class: Govspeak::StructuredHeader

Inherits:
Struct
  • Object
show all
Defined in:
lib/govspeak/structured_header_extractor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#headersObject

Returns the value of attribute headers

Returns:

  • (Object)

    the current value of headers



3
4
5
# File 'lib/govspeak/structured_header_extractor.rb', line 3

def headers
  @headers
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



3
4
5
# File 'lib/govspeak/structured_header_extractor.rb', line 3

def id
  @id
end

#levelObject

Returns the value of attribute level

Returns:

  • (Object)

    the current value of level



3
4
5
# File 'lib/govspeak/structured_header_extractor.rb', line 3

def level
  @level
end

#textObject

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



3
4
5
# File 'lib/govspeak/structured_header_extractor.rb', line 3

def text
  @text
end

Instance Method Details

#to_hObject



12
13
14
15
16
# File 'lib/govspeak/structured_header_extractor.rb', line 12

def to_h
  Hash[members.zip(values)].merge(
    headers: headers.map(&:to_h),
  )
end

#top_levelObject



4
5
6
# File 'lib/govspeak/structured_header_extractor.rb', line 4

def top_level
  2
end

#top_level?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/govspeak/structured_header_extractor.rb', line 8

def top_level?
  level == top_level
end