Class: HexaPDF::Content::NamedValue

Inherits:
Object
  • Object
show all
Defined in:
lib/hexapdf/content/graphics_state.rb

Overview

Associates a name with a value, used by various graphics state parameters.

See LineCapStyle, LineJoinStyle, TextRenderingMode

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value) ⇒ NamedValue

Creates a new NamedValue object and freezes it.



57
58
59
60
61
# File 'lib/hexapdf/content/graphics_state.rb', line 57

def initialize(name, value)
  @name = name
  @value = value
  freeze
end

Instance Attribute Details

#nameObject (readonly)

The name for the value.



54
55
56
# File 'lib/hexapdf/content/graphics_state.rb', line 54

def name
  @name
end

#valueObject (readonly)

The value itself.



51
52
53
# File 'lib/hexapdf/content/graphics_state.rb', line 51

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object

The object is equal to other if either the name or the value is equal to other, or if the other object is a NamedValue object with the same name and value.



65
66
67
68
# File 'lib/hexapdf/content/graphics_state.rb', line 65

def ==(other)
  @name == other || @value == other ||
    (other.kind_of?(NamedValue) && @name == other.name && @value == other.value)
end

#to_operandsObject

Returns the value.



71
72
73
# File 'lib/hexapdf/content/graphics_state.rb', line 71

def to_operands
  @value
end