Class: Headown::Extractor
- Inherits:
-
Object
- Object
- Headown::Extractor
- Defined in:
- lib/headown.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
Instance Method Summary collapse
-
#initialize(file_path) ⇒ Extractor
constructor
A new instance of Extractor.
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
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
14 15 16 |
# File 'lib/headown.rb', line 14 def headers @headers end |