added convinent to_s method for RelativeOperation
This commit is contained in:
@@ -32,6 +32,14 @@ module CliGen::Timeparse
|
||||
raw.scan(CliGen::Regex::RELATIVE_OPERATION).map{|match| from_regex(match)}
|
||||
end
|
||||
|
||||
def to_s(io : IO)
|
||||
io << to_s
|
||||
end
|
||||
|
||||
def to_s
|
||||
"%s%d %s" % [ @sign == -1 ? "-" : "+", @quantity, @unit.to_s.downcase ]
|
||||
end
|
||||
|
||||
# Just an initializer from a regex match. Only callable internally
|
||||
# so any operations must come from get_operations as that will handle
|
||||
# parsing it for the user
|
||||
|
||||
Reference in New Issue
Block a user