Sha256: 851e7db4554ac3d352b36512c8aed780eda8f76e59d7ea6268457e33d4aefe5c
Contents?: true
Size: 667 Bytes
Versions: 9
Compression:
Stored size: 667 Bytes
Contents
on "calc", args: [:a, :b], opts: { op: { description: "The operation to perform", type: "string", required: true } }, desc: "Perform an arithmetic operation between two numbers", long_desc: "Operations supported are provided with their respective symbols passed as the --op option.", examples: "Addition:\n\n !calc --op + 1 2\n\n" \ "Subtraction:\n\n !calc --op - 5 3\n\n" \ "Multiplication:\n\n !calc --op * 2 5\n\n" \ "Division:\n\n !calc --op / 30 2\n\n", rules: ["allow"] do result = args.map(&:to_i).inject(&opts["op"].to_sym) "Hello #{handle}, the answer is: #{result}" end
Version data entries
9 entries across 9 versions & 1 rubygems