File: definition.rb

package info (click to toggle)
ruby-clamp 1.1.1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, trixie
  • size: 312 kB
  • sloc: ruby: 2,359; makefile: 4
file content (25 lines) | stat: -rw-r--r-- 496 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module Clamp
  module Subcommand

    Definition = Struct.new(:name, :description, :subcommand_class) do

      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
end