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(lit) ⇒ 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(sub) ⇒ Expr
Check if string values end with a binary substring.
-
#starts_with(sub) ⇒ Expr
Check if values start with a binary substring.
Instance Method Details
#contains(lit) ⇒ Expr
Check if binaries in Series contain a binary substring.
18 19 20 |
# File 'lib/polars/binary_expr.rb', line 18 def contains(lit) Utils.wrap_expr(_rbexpr.binary_contains(lit)) end |
#decode(encoding, strict: true) ⇒ Expr
Decode a value using the provided encoding.
51 52 53 54 55 56 57 58 59 |
# File 'lib/polars/binary_expr.rb', line 51 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.
67 68 69 70 71 72 73 74 75 |
# File 'lib/polars/binary_expr.rb', line 67 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(sub) ⇒ Expr
Check if string values end with a binary substring.
28 29 30 |
# File 'lib/polars/binary_expr.rb', line 28 def ends_with(sub) Utils.wrap_expr(_rbexpr.binary_ends_with(sub)) end |
#starts_with(sub) ⇒ Expr
Check if values start with a binary substring.
38 39 40 |
# File 'lib/polars/binary_expr.rb', line 38 def starts_with(sub) Utils.wrap_expr(_rbexpr.binary_starts_with(sub)) end |