Class: Headown::Extractor

Inherits:
Object
  • Object
show all
Defined in:
lib/headown.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ Extractor

Returns a new instance of Extractor.



16
17
18
19
20
21
# File 'lib/headown.rb', line 16

def initialize(file_path)
  raise Headown::NotMarkdownError.new(file_path: file_path) if File.extname(file_path) != '.md'

  file_data = URI.open(file_path, &:read)
  extract_headers(file_data)
end

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



14
15
16
# File 'lib/headown.rb', line 14

def headers
  @headers
end