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



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

def headers
  @headers
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



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

def id
  @id
end

#levelObject

Returns the value of attribute level

Returns:

  • (Object)

    the current value of level



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

def level
  @level
end

#textObject

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



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

def text
  @text
end

Instance Method Details

#to_hObject



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

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

#top_levelObject



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

def top_level
  2
end

#top_level?Boolean

Returns:

  • (Boolean)


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

def top_level?
  level == top_level
end