Sha256: 8e01fc61bbcfa1ee4161ab508cfed626082949ad93dfffaa0dba109f06c9505f

Contents?: true

Size: 445 Bytes

Versions: 18

Compression:

Stored size: 445 Bytes

Contents

module Clamp

  class Subcommand < Struct.new(:name, :description, :subcommand_class)

    def initialize(names, description, subcommand_class)
      @names = Array(names)
      @description = description
      @subcommand_class = subcommand_class
    end

    attr_reader :names, :description, :subcommand_class

    def is_called?(name)
      names.member?(name)
    end

    def help
      [names.join(", "), description]
    end

  end

end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
clamp-0.5.1 lib/clamp/subcommand.rb
clamp-0.5.0 lib/clamp/subcommand.rb
clamp-0.4.0 lib/clamp/subcommand.rb
jls-clamp-0.3.1.2 lib/clamp/subcommand.rb
jls-clamp-0.3.1 lib/clamp/subcommand.rb
clamp-0.3.1 lib/clamp/subcommand.rb
clamp-0.3.0 lib/clamp/subcommand.rb
clamp-0.2.3 lib/clamp/subcommand.rb
clamp-0.2.2 lib/clamp/subcommand.rb
clamp-0.2.1 lib/clamp/subcommand.rb
clamp-0.2.0 lib/clamp/subcommand.rb
wpb-0.0.5 lib/wpb/clamp/subcommand.rb
clamp-0.1.8 lib/clamp/subcommand.rb
clamp-0.1.7 lib/clamp/subcommand.rb
clamp-0.1.6 lib/clamp/subcommand.rb
clamp-0.1.5 lib/clamp/subcommand.rb
clamp-0.1.4 lib/clamp/subcommand.rb
clamp-0.1.3 lib/clamp/subcommand.rb