class LTools::Tool::ToolOpts

Public Class Methods

build(&block) click to toggle source
# File lib/core/opts.rb, line 6
def self.build(&block)
  new(&block).to_s
end
new() { |self| ... } click to toggle source
# File lib/core/opts.rb, line 10
def initialize
        @args = []
        yield self if block_given?
end

Public Instance Methods

on(opt, value, &block) click to toggle source
# File lib/core/opts.rb, line 15
            def on(opt, value, &block)
                    if value
                            value = block.call(value) if block
                            if value
@args << opt if opt
@args << value
                            end
                    end
            end
to_a() click to toggle source
# File lib/core/opts.rb, line 33
def to_a
        @args
end
to_s() click to toggle source
# File lib/core/opts.rb, line 25
                def to_s
to_str
                end
to_str() click to toggle source
# File lib/core/opts.rb, line 29
def to_str
                          " #{Shellwords.join(@args)} "
end