Sha256: e6aa62039757e03edf9da5a08a46a307d42987d445343fc62eeaaea5c1eb963e

Contents?: true

Size: 651 Bytes

Versions: 1

Compression:

Stored size: 651 Bytes

Contents

on "calc",
  args: [:a, :b],
  opts: { op: { description: "The operation to perform", type: "string" } },
  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

1 entries across 1 versions & 1 rubygems

Version Path
cogy-0.1.0 test/dummy/cogy/fully_fledged.rb