Class: Lutra::Scanner

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tags: Lutra::TAGS, comments: Lutra::COMMENTS) ⇒ Scanner

Returns a new instance of Scanner.

Raises:



8
9
10
11
12
13
14
# File 'lib/lutra/scanner.rb', line 8

def initialize(tags: Lutra::TAGS, comments: Lutra::COMMENTS)
  raise EmptyTagListError if tags.empty?
  raise EmptyCommentListError if comments.empty?

  @tags, @comments = tags, comments
  @notes = []
end

Instance Attribute Details

#commentsObject

Returns the value of attribute comments.



5
6
7
# File 'lib/lutra/scanner.rb', line 5

def comments
  @comments
end

#notesObject (readonly)

Returns the value of attribute notes.



6
7
8
# File 'lib/lutra/scanner.rb', line 6

def notes
  @notes
end

#tagsObject

Returns the value of attribute tags.



5
6
7
# File 'lib/lutra/scanner.rb', line 5

def tags
  @tags
end

Instance Method Details

#scan_file(path) ⇒ Object



16
17
18
# File 'lib/lutra/scanner.rb', line 16

def scan_file(path)
  extract(File.open(path), path)
end