Class: Polars::BinaryExpr
- Inherits:
-
Object
- Object
- Polars::BinaryExpr
- Defined in:
- lib/polars/binary_expr.rb
Overview
Namespace for binary related expressions.
Instance Method Summary collapse
-
#contains(literal) ⇒ Expr
Check if binaries in Series contain a binary substring.
-
#decode(encoding, strict: true) ⇒ Expr
Decode a value using the provided encoding.
-
#encode(encoding) ⇒ Expr
Encode a value using the provided encoding.
-
#ends_with(suffix) ⇒ Expr
Check if string values end with a binary substring.
-
#starts_with(prefix) ⇒ Expr
Check if values start with a binary substring.
Instance Method Details
#contains(literal) ⇒ Expr
Check if binaries in Series contain a binary substring.
43 44 45 46 |
# File 'lib/polars/binary_expr.rb', line 43 def contains(literal) literal = Utils.parse_into_expression(literal, str_as_lit: true) Utils.wrap_expr(_rbexpr.binary_contains(literal)) end |
#decode(encoding, strict: true) ⇒ Expr
Decode a value using the provided encoding.
153 154 155 156 157 158 159 160 161 |
# File 'lib/polars/binary_expr.rb', line 153 def decode(encoding, strict: true) if encoding == "hex" Utils.wrap_expr(_rbexpr.binary_hex_decode(strict)) elsif encoding == "base64" Utils.wrap_expr(_rbexpr.binary_base64_decode(strict)) else raise ArgumentError, "encoding must be one of {{'hex', 'base64'}}, got #{encoding}" end end |
#encode(encoding) ⇒ Expr
Encode a value using the provided encoding.
191 192 193 194 195 196 197 198 199 |
# File 'lib/polars/binary_expr.rb', line 191 def encode(encoding) if encoding == "hex" Utils.wrap_expr(_rbexpr.binary_hex_encode) elsif encoding == "base64" Utils.wrap_expr(_rbexpr.binary_base64_encode) else raise ArgumentError, "encoding must be one of {{'hex', 'base64'}}, got #{encoding}" end end |
#ends_with(suffix) ⇒ Expr
Check if string values end with a binary substring.
79 80 81 82 |
# File 'lib/polars/binary_expr.rb', line 79 def ends_with(suffix) suffix = Utils.parse_into_expression(suffix, str_as_lit: true) Utils.wrap_expr(_rbexpr.binary_ends_with(suffix)) end |
#starts_with(prefix) ⇒ Expr
Check if values start with a binary substring.
117 118 119 120 |
# File 'lib/polars/binary_expr.rb', line 117 def starts_with(prefix) prefix = Utils.parse_into_expression(prefix, str_as_lit: true) Utils.wrap_expr(_rbexpr.binary_starts_with(prefix)) end |