Class: Tmux::Options::Option Abstract Private

Inherits:
Object
  • Object
show all
Defined in:
lib/tmux/options/option.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.

This class is abstract.

This class is the base for all typecasting in ruby-tmux. It will handle default and none. All other conversions have to be done by classes inheriting from this one. You should never have to instantiate or work with any of those classes yourself.

Class Method Summary collapse

Class Method Details

.from_tmux(value) ⇒ Object, Symbol

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.

Takes an option value from tmux and converts it to an appropriate Ruby object.

Parameters:

  • value (String)

    the value to cast

Returns:

  • (Object, Symbol)

    Either the specific Ruby object, or either :default or :none

See Also:

  • Subclasses


18
19
20
21
22
# File 'lib/tmux/options/option.rb', line 18

def from_tmux(value)
  if [:default, :none].include?(value)
    return value.to_sym
  end
end

.to_tmux(value) ⇒ String

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.

Converts a Ruby object to a value for tmux.

Parameters:

  • value (Object)

    the value to cast

Returns:

  • (String)

See Also:

  • Subclasses


30
31
32
33
34
# File 'lib/tmux/options/option.rb', line 30

def to_tmux(value)
  if [:default, :none].include?(value)
    return value.to_s
  end
end