class
MPD::CommandBuilder
- MPD::CommandBuilder
- Reference
- Object
Defined in:
crystal_mpd/command_builder.crClass Method Summary
- .build(command : String, *args) : String
-
.parse_range(range : MPD::Range) : String
Converts a Crystal Range into an MPD-compatible "START:END" string.
Class Method Detail
def self.parse_range(range : MPD::Range) : String
#
Converts a Crystal Range into an MPD-compatible "START:END" string.
MPD treats the range as exclusive, so:
- Inclusive ranges (e.g., 0..2) must be converted to "0:3" to include index 2
- Exclusive ranges (e.g., 0...2) are used directly as "0:2"
Examples:
(0..20)
-> "0:21"
(0...20)
-> "0:20"
(..5)
-> "0:6"
(5..)
-> "5:"