Class: Rudachi::FileParser

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

Direct Known Subclasses

TextParser

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**opts) ⇒ FileParser

Returns a new instance of FileParser.



10
11
12
13
# File 'lib/rudachi/file_parser.rb', line 10

def initialize(**opts)
  Rudachi::Loader.load!
  @opts = Option.new(**opts)
end

Class Method Details

.parse(path) ⇒ Object



6
7
8
# File 'lib/rudachi/file_parser.rb', line 6

def self.parse(path)
  new.parse(path)
end

Instance Method Details

#parse(path) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/rudachi/file_parser.rb', line 15

def parse(path)
  output_stream do |output|
    take_stdout(output) do
      Java::SudachiCommandLine.main(
        Option.cmds(@opts).push(path)
      )
    end
  end
end