Class: Odca::Overlays::Header

Inherits:
Object
  • Object
show all
Defined in:
lib/odca/overlays/header.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(role:, purpose:, type:, issued_by: '') ⇒ Header

Returns a new instance of Header.



6
7
8
9
10
11
# File 'lib/odca/overlays/header.rb', line 6

def initialize(role:, purpose:, type:, issued_by: '')
  @issued_by = issued_by
  @role = role
  @purpose = purpose
  @type = type
end

Instance Attribute Details

#issued_byObject (readonly)

Returns the value of attribute issued_by.



4
5
6
# File 'lib/odca/overlays/header.rb', line 4

def issued_by
  @issued_by
end

#purposeObject (readonly)

Returns the value of attribute purpose.



4
5
6
# File 'lib/odca/overlays/header.rb', line 4

def purpose
  @purpose
end

#roleObject (readonly)

Returns the value of attribute role.



4
5
6
# File 'lib/odca/overlays/header.rb', line 4

def role
  @role
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/odca/overlays/header.rb', line 4

def type
  @type
end

Instance Method Details

#to_hObject



13
14
15
16
17
18
19
20
21
# File 'lib/odca/overlays/header.rb', line 13

def to_h
  {
    '@context' => 'https://odca.tech/overlays/v1',
    type: type,
    issued_by: issued_by,
    role: role || '',
    purpose: purpose || ''
  }
end