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.
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.
52 53 54 55 56 |
# File 'lib/hexapdf/content/graphics_state.rb', line 52 def initialize(name, value) @name = name @value = value freeze end |
Instance Attribute Details
#name ⇒ Object (readonly)
The name for the value.
49 50 51 |
# File 'lib/hexapdf/content/graphics_state.rb', line 49 def name @name end |
#value ⇒ Object (readonly)
The value itself.
46 47 48 |
# File 'lib/hexapdf/content/graphics_state.rb', line 46 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.
60 61 62 63 |
# File 'lib/hexapdf/content/graphics_state.rb', line 60 def ==(other) @name == other || @value == other || (other.kind_of?(NamedValue) && @name == other.name && @value == other.value) end |
#to_operands ⇒ Object
Returns the value.
66 67 68 |
# File 'lib/hexapdf/content/graphics_state.rb', line 66 def to_operands @value end |