disu.se

EnumerationClass

Namespace

Ame::Types

Ancestors
  1. Object

Enumeration type for limiting a Symbol argument to one in a fixed set. It also has a #default, which will be the first symbol passed to its constructor.

Example: Using an Enumeration
class Git::CLI::Git::FormatPatch < Ame::Class
  switch '', 'thread', 'STYLE', nil,
    Ame::Types::Enumeration[:shallow, :deep],
    'Controls addition of In-Reply-To and References headers'

Class Methods

[]#

This is an alias for .new.

Constructor

initialize(first#to_sym, second#to_sym, *rest#to_sym*)#

Creates an Enumeration of valid Symbols first, second, and rest for an argument and sets #default to first.

Instance Methods

defaultSymbol#

Returns the Symbol to use if no argument has been given.