Class: Toys::FlagGroup::Base

Inherits:
Object
  • Object
show all
Defined in:
core-docs/toys/flag_group.rb

Overview

Defined in the toys-core gem

The base class of a FlagGroup, implementing everything except validation. The base class effectively behaves as an Optional group. And the default group that contains flags not otherwise assigned to a group, is of this type. However, you should use Optional when creating an explicit optional group.

Direct Known Subclasses

AtLeastOne, AtMostOne, ExactlyOne, Optional, Required

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#descToys::WrappableString

The short description string.

When reading, this is always returned as a WrappableString.

When setting, the description may be provided as any of the following:

  • A WrappableString.
  • A normal String, which will be transformed into a WrappableString using spaces as word delimiters.
  • An Array of String, which will be transformed into a WrappableString where each array element represents an individual word for wrapping.


65
66
67
# File 'core-docs/toys/flag_group.rb', line 65

def desc
  @desc
end

#flagsArray<Toys::Flag> (readonly)

An array of flags that are in this group. Do not modify the returned array.

Returns:



91
92
93
# File 'core-docs/toys/flag_group.rb', line 91

def flags
  @flags
end

#long_descArray<Toys::WrappableString>

The long description strings.

When reading, this is returned as an Array of WrappableString representing the lines in the description.

When setting, the description must be provided as an Array where each element may be any of the following:

  • A WrappableString representing one line.
  • A normal String representing a line. This will be transformed into a WrappableString using spaces as word delimiters.
  • An Array of String representing a line. This will be transformed into a WrappableString where each array element represents an individual word for wrapping.

Returns:



84
85
86
# File 'core-docs/toys/flag_group.rb', line 84

def long_desc
  @long_desc
end

#nameString, ... (readonly)

The symbolic name for this group

Returns:

  • (String, Symbol, nil)


48
49
50
# File 'core-docs/toys/flag_group.rb', line 48

def name
  @name
end

Instance Method Details

#append_long_desc(long_desc) ⇒ self

Append long description strings.

You must pass an array of lines in the long description. See #long_desc for details on how each line may be represented.

Parameters:

Returns:

  • (self)


141
142
143
# File 'core-docs/toys/flag_group.rb', line 141

def append_long_desc(long_desc)
  # Source available in the toys-core gem
end

#empty?Boolean

Returns true if this group is empty

Returns:

  • (Boolean)


97
98
99
# File 'core-docs/toys/flag_group.rb', line 97

def empty?
  # Source available in the toys-core gem
end

#summaryString

Returns a string summarizing this group. This is generally either the short description or a representation of all the flags included.

Returns:

  • (String)


106
107
108
# File 'core-docs/toys/flag_group.rb', line 106

def summary
  # Source available in the toys-core gem
end