Sha256: a5ae5b2847cddfc629515e5594ac149849ecdb42830ca387aefee9508131dd29
Contents?: true
Size: 364 Bytes
Versions: 1
Compression:
Stored size: 364 Bytes
Contents
module Calc class NormalizeArgs < Micro::Service::Base attributes :args def call! a, b = normalize(args[:a]), normalize(args[:b]) return Success(a: a, b: b) if a !~ /\s/ && b !~ /\s/ Failure(:arguments_with_space_chars) { [a.inspect, b.inspect] } end private def normalize(value) String(value).strip end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
u-service-0.13.0 | examples/calculator/calc/normalize_args.rb |