Sha256: 536e90e596f7c5beddcdcdf8b4de8e6eafde285635236960807598bba5cd32ec

Contents?: true

Size: 639 Bytes

Versions: 1

Compression:

Stored size: 639 Bytes

Contents

module Kommand
  module Scripts
    class Arguments < Array
      
      def to_s
        map do |arg|
          #if arg.valid.nil? || arg.valid.empty?
            "[#{arg.keys.join(", ")}]"
          #else
          #  "[#{arg.keys.join(", ")} = (#{arg.valid.join("|")})]"
          #end
        end.join(" ")
      end

      def to_help
        map do |arg|
          "  #{"%-#{sort { |a,b| a.keys.join(", ").length <=> b.keys.join(", ").length }.last.keys.join(", ").length + 2}s" % arg.keys.join(", ")}# #{arg.summary}"
        end.join("\n")
      end

      protected

      def initialize
        super
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kommand-0.0.1 lib/kommand/scripts/arguments.rb