Class: Option Private

Inherits:
Object
  • Object
show all
Defined in:
Library/Homebrew/options.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

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. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Option.


9
10
11
12
13
# File 'Library/Homebrew/options.rb', line 9

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

Instance Attribute Details

#descriptionObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


7
8
9
# File 'Library/Homebrew/options.rb', line 7

def description
  @description
end

#flagObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


7
8
9
# File 'Library/Homebrew/options.rb', line 7

def flag
  @flag
end

#nameObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


7
8
9
# File 'Library/Homebrew/options.rb', line 7

def name
  @name
end

Instance Method Details

#<=>(other) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


19
20
21
22
23
# File 'Library/Homebrew/options.rb', line 19

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. You should avoid using this method if possible, as it may be removed or be changed in the future.


25
26
27
# File 'Library/Homebrew/options.rb', line 25

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

#hashObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


30
31
32
# File 'Library/Homebrew/options.rb', line 30

def hash
  name.hash
end

#inspectObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


34
35
36
# File 'Library/Homebrew/options.rb', line 34

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

#to_sObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


15
16
17
# File 'Library/Homebrew/options.rb', line 15

def to_s
  flag
end