Class: TTY::Link::HyperlinkParameter Private

Inherits:
Object
  • Object
show all
Defined in:
lib/tty/link/hyperlink_parameter.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.

Responsible for representing hyperlink parameter value

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ HyperlinkParameter

Create a TTY::Link::HyperlinkParameter instance

Examples:

hyperlink_parameter = TTY::Link::HyperlinkParameter.new(:always)

Parameters:

  • value (String, Symbol)

    the parameter value

Raises:



29
30
31
# File 'lib/tty/link/hyperlink_parameter.rb', line 29

def initialize(value)
  @value = validate(value).to_sym
end

Instance Method Details

#always?Boolean

Check whether this parameter value is always

Examples:

hyperlink_parameter.always?
# => true

Returns:

  • (Boolean)


42
43
44
# File 'lib/tty/link/hyperlink_parameter.rb', line 42

def always?
  @value == :always
end

#auto?Boolean

Check whether this parameter value is auto

Examples:

hyperlink_parameter.auto?
# => false

Returns:

  • (Boolean)


55
56
57
# File 'lib/tty/link/hyperlink_parameter.rb', line 55

def auto?
  @value == :auto
end

#never?Boolean

Check whether this parameter value is never

Examples:

hyperlink_parameter.never?
# => false

Returns:

  • (Boolean)


68
69
70
# File 'lib/tty/link/hyperlink_parameter.rb', line 68

def never?
  @value == :never
end