Class: Metanorma::Mirror::Model::Guide

Inherits:
Object
  • Object
show all
Defined in:
lib/metanorma/mirror/model/guide.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content:, meta: {}, title: nil) ⇒ Guide

Returns a new instance of Guide.



9
10
11
12
13
# File 'lib/metanorma/mirror/model/guide.rb', line 9

def initialize(content:, meta: {}, title: nil)
  @content = content
  @meta = meta
  @title = title
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



7
8
9
# File 'lib/metanorma/mirror/model/guide.rb', line 7

def content
  @content
end

#metaObject (readonly)

Returns the value of attribute meta.



7
8
9
# File 'lib/metanorma/mirror/model/guide.rb', line 7

def meta
  @meta
end

#titleObject (readonly)

Returns the value of attribute title.



7
8
9
# File 'lib/metanorma/mirror/model/guide.rb', line 7

def title
  @title
end

Instance Method Details

#to_hObject



15
16
17
18
19
20
21
# File 'lib/metanorma/mirror/model/guide.rb', line 15

def to_h
  h = {}
  h["content"] = @content.is_a?(Container) ? @content.to_h : @content
  h["meta"] = @meta unless @meta.nil? || @meta.empty?
  h["title"] = @title if @title
  h
end