Class: PryTheme::TERM Private

Inherits:
Object
  • Object
show all
Defined in:
lib/pry-theme/term.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.

Represents a terminal colour (not ANSI). Checks whether a number fits in its colour model.

Since:

  • 0.2.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, color_model = 256) ⇒ TERM

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 TERM.

Parameters:

  • value (Integer)
  • color_model (Integer) (defaults to: 256)

Since:

  • 0.2.0



14
15
16
17
18
# File 'lib/pry-theme/term.rb', line 14

def initialize(value, color_model = 256)
  validate_attrs(value, color_model)
  @value = value
  @color_model = color_model
end

Instance Attribute Details

#color_modelInteger (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.

Returns the values are 8, 16 or 256.

Returns:

  • (Integer)

    the values are 8, 16 or 256

Since:

  • 0.2.0



10
11
12
# File 'lib/pry-theme/term.rb', line 10

def color_model
  @color_model
end

Instance Method Details

#inspectString

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:

  • (String)

Since:

  • 0.2.0



21
22
23
# File 'lib/pry-theme/term.rb', line 21

def inspect
  "(TERM-#{ @color_model }: #{ @value })"
end

#to_iInteger

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:

  • (Integer)

Since:

  • 0.2.0



26
27
28
# File 'lib/pry-theme/term.rb', line 26

def to_i
  @value
end