Class: Option Private

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
options.rb

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

A formula option.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, description = "") ⇒ Option

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns a new instance of Option.



12
13
14
15
16
# File 'options.rb', line 12

def initialize(name, description = "")
  @name = name
  @flag = "--#{name}"
  @description = description
end

Instance Attribute Details

#descriptionObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



10
11
12
# File 'options.rb', line 10

def description
  @description
end

#flagObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



10
11
12
# File 'options.rb', line 10

def flag
  @flag
end

#nameObject (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



10
11
12
# File 'options.rb', line 10

def name
  @name
end

Instance Method Details

#<=>(other) ⇒ Object

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



22
23
24
25
26
# File 'options.rb', line 22

def <=>(other)
  return unless other.is_a?(Option)

  name <=> other.name
end

#==(other) ⇒ Object Also known as: eql?

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



28
29
30
# File 'options.rb', line 28

def ==(other)
  instance_of?(other.class) && name == other.name
end

#hashObject

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



33
34
35
# File 'options.rb', line 33

def hash
  name.hash
end

#inspectString

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



38
39
40
# File 'options.rb', line 38

def inspect
  "#<#{self.class.name}: #{flag.inspect}>"
end

#to_sObject

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



18
19
20
# File 'options.rb', line 18

def to_s
  flag
end