module Opal::CLI::Tools::InputReader

Overview

Intelligent stream parser and format sensor for Unix CLI utilities.

Defined in:

opal/cli/tools/input_reader.cr

Class Method Summary

Class Method Detail

def self.clean(content : String) : String #

Cleans content by stripping UTF-8 BOM and surrounding whitespace


[View source]
def self.detect_format(content : String) : Symbol #

Auto-detects data format from raw string content.


[View source]
def self.parse_key_value_pairs(content : String) : Array(Tuple(String, Float64)) #

Parses key-value pairs (e.g. for BarChart, PieChart) from JSON, TSV, or lines.


[View source]
def self.parse_labeled_series(content : String) : Array(Tuple(String, Float64)) #

Alias for parse_key_value_pairs


[View source]
def self.parse_number_series(content : String) : Array(Float64) #

Alias for parse_numeric_stream


[View source]
def self.parse_numeric_stream(content : String) : Array(Float64) #

Parses a stream of numeric values (for Sparkline or single-series LineGraph).


[View source]
def self.parse_table_data(content : String, format : Symbol = :auto, delimiter : String | Nil = nil, custom_headers : Array(String) | Nil = nil, no_headers : Bool = false) : Tuple(Array(String), Array(Array(String))) #

Parses tabular data into {headers, rows} with format detection and delimiter overrides.


[View source]