Sha256: bd8ba1ae338f86e47bc89d5d5a09a5e24ebe3573f7ca42c31c1911f0776055f3
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
class CountArgs attr_accessor :options def initialize(options) self.options = options end def call(*args) puts "#{self.class} called with #{args.length} args" end end class Amazing def self.specify_options(expect) expect.banner "describe NAME" expect.text "say that someone is amazing" expect.opt :forcefully end attr_accessor :options def initialize(options) self.options = options end def describe(name) ret = "#{name} is amazing" puts options[:forcefully] ? ret.upcase : ret end end class SimpleTask < Ing::Task desc "My great task of immense importance" desc "A simple example of a task using Ing::Task" usage " ing simple_task [OPTIONS]" opt :fast, "Run it at fast speed" opt :altitude, "Start altitude", :type => :integer def call # .... end end class BigTask < SimpleTask desc "Even bigger!" opt :yards, "Yards of fishing line given", :type => :integer, :default => 25 opt :color, "Color of cloth", :type => :string, :default => 'green' default :fast, true modify_option :altitude, :short => 'l', :default => 2500 end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ing-0.2.1 | test/fixtures/task.ing.rb |
ing-0.1.5 | test/fixtures/task.ing.rb |