Class: EideticPDF::PdfObjects::PdfName

Inherits:
Object
  • Object
show all
Defined in:
lib/epdfo.rb

Overview

name of PDF entity, written as /Name

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ PdfName

Returns a new instance of PdfName.



203
204
205
# File 'lib/epdfo.rb', line 203

def initialize(name)
  @name = name.to_s
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



201
202
203
# File 'lib/epdfo.rb', line 201

def name
  @name
end

Class Method Details

.ary(string_ary) ⇒ Object



223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/epdfo.rb', line 223

def self.ary(string_ary)
  p_ary = string_ary.map do |s|
    if s.respond_to?(:to_str)
      PdfName.new(s.to_str)
    elsif s.respond_to?(:to_ary)
      PdfName.ary(s.to_ary)
    else
      s
    end
  end
  PdfArray.new p_ary
end

Instance Method Details

#==(other) ⇒ Object



219
220
221
# File 'lib/epdfo.rb', line 219

def ==(other)
  other.respond_to?(:name) && self.name == other.name
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


215
216
217
# File 'lib/epdfo.rb', line 215

def eql?(other)
  self.name.eql?(other.name)
end

#hashObject



211
212
213
# File 'lib/epdfo.rb', line 211

def hash
  self.to_s.hash
end

#to_sObject



207
208
209
# File 'lib/epdfo.rb', line 207

def to_s
  "/#{name} "
end