Class: Evilution::CLI::Parser::StdinReader Private
- Inherits:
-
Object
- Object
- Evilution::CLI::Parser::StdinReader
- Defined in:
- lib/evilution/cli/parser/stdin_reader.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: Result
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object private
-
#initialize(io, existing_files:) ⇒ StdinReader
constructor
private
A new instance of StdinReader.
Constructor Details
#initialize(io, existing_files:) ⇒ StdinReader
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of StdinReader.
12 13 14 15 |
# File 'lib/evilution/cli/parser/stdin_reader.rb', line 12 def initialize(io, existing_files:) @io = io @existing_files = existing_files end |
Class Method Details
.call(io, existing_files:) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
8 9 10 |
# File 'lib/evilution/cli/parser/stdin_reader.rb', line 8 def self.call(io, existing_files:) new(io, existing_files: existing_files).call end |
Instance Method Details
#call ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/evilution/cli/parser/stdin_reader.rb', line 17 def call return Result.new([], {}, "--stdin cannot be combined with positional file arguments") if @existing_files.any? lines = [] @io.each_line do |line| line = line.strip lines << line unless line.empty? end parsed_paths = Evilution::CLI::Parser::FileArgs.parse(lines) Result.new(parsed_paths.files, parsed_paths.ranges, nil) end |