Class: Rudachi::FileParser
- Inherits:
-
Object
- Object
- Rudachi::FileParser
- Defined in:
- lib/rudachi/file_parser.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**opts) ⇒ FileParser
constructor
A new instance of FileParser.
- #parse(path) ⇒ Object
Constructor Details
#initialize(**opts) ⇒ FileParser
10 11 12 13 14 15 |
# File 'lib/rudachi/file_parser.rb', line 10 def initialize(**opts) Rudachi.load! @output = Java::ByteArrayOutputStream.new @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
17 18 19 20 21 22 23 24 |
# File 'lib/rudachi/file_parser.rb', line 17 def parse(path) take_stdout do Java::SudachiCommandLine.main( Option.cmds(@opts).push(Java::String.new(path)) ) end @output.toString end |