Class: HexaPDF::Content::NamedValue
- Inherits:
-
Object
- Object
- HexaPDF::Content::NamedValue
- 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
-
#name ⇒ Object
readonly
The name for the value.
-
#value ⇒ Object
readonly
The value itself.
Instance Method Summary collapse
-
#==(other) ⇒ Object
The object is equal to
other
if either the name or the value is equal toother
, or if the other object is a NamedValue object with the same name and value. -
#initialize(name, value) ⇒ NamedValue
constructor
Creates a new NamedValue object and freezes it.
-
#to_operands ⇒ Object
Returns the value.
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
#name ⇒ Object (readonly)
The name for the value.
54 55 56 |
# File 'lib/hexapdf/content/graphics_state.rb', line 54 def name @name end |
#value ⇒ Object (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_operands ⇒ Object
Returns the value.
71 72 73 |
# File 'lib/hexapdf/content/graphics_state.rb', line 71 def to_operands @value end |