Sha256: 7c35940910687d4d26652db029806d33f6de50474af2833dfc51140d644358be
Contents?: true
Size: 517 Bytes
Versions: 3
Compression:
Stored size: 517 Bytes
Contents
#! /usr/bin/env ruby # frozen_string_literal: true # A simple Clamp command, with options and parameters require "clamp" Clamp do banner %( Say something. ) option "--loud", :flag, "say it loud" option ["-n", "--iterations"], "N", "say it N times", default: 1 do |s| Integer(s) end parameter "WORDS ...", "the thing to say", attribute_name: :words def execute the_truth = words.join(" ") the_truth.upcase! if loud? iterations.times do puts the_truth end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
clamp-1.3.2 | examples/speak |
clamp-1.3.1 | examples/speak |
clamp-1.3.0 | examples/speak |