Class: Proforma::Document

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

Overview

A rendering engine will output one or more of these objects. It is the final realization of the compilation + rendering process.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contents: nil, extension: '', title: '') ⇒ Document

Returns a new instance of Document.



18
19
20
21
22
23
24
# File 'lib/proforma/document.rb', line 18

def initialize(contents: nil, extension: '', title: '')
  @contents   = contents
  @extension  = extension
  @title      = title

  freeze
end

Instance Attribute Details

#contentsObject (readonly)

Returns the value of attribute contents.



16
17
18
# File 'lib/proforma/document.rb', line 16

def contents
  @contents
end

#extensionObject (readonly)

Returns the value of attribute extension.



16
17
18
# File 'lib/proforma/document.rb', line 16

def extension
  @extension
end

#titleObject (readonly)

Returns the value of attribute title.



16
17
18
# File 'lib/proforma/document.rb', line 16

def title
  @title
end

Instance Method Details

#==(other) ⇒ Object



34
35
36
# File 'lib/proforma/document.rb', line 34

def ==(other)
  eql?(other)
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
29
30
31
32
# File 'lib/proforma/document.rb', line 26

def eql?(other)
  return false unless other.is_a?(self.class)

  contents == other.contents &&
    extension == other.extension &&
    title == other.title
end