Module: Ollama::Utils::FileArgument
- Defined in:
- lib/ollama/utils/file_argument.rb
Class Method Summary collapse
-
.get_file_argument(path_or_content, default: nil) ⇒ String
Returns the contents of a file or string, or a default value if neither is provided.
Class Method Details
.get_file_argument(path_or_content, default: nil) ⇒ String
Returns the contents of a file or string, or a default value if neither is provided.
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ollama/utils/file_argument.rb', line 22 def get_file_argument(path_or_content, default: nil) if path_or_content.present? && path_or_content.size < 2 ** 15 && File.basename(path_or_content).size < 2 ** 8 && File.exist?(path_or_content) then File.read(path_or_content) elsif path_or_content.present? path_or_content else default end end |