Class: Commenter::CommentSheet

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/commenter/comment_sheet.rb

Overview

One ballot submission: metadata plus its comments. Serialization is declared with lutaml-model.

Instance Method Summary collapse

Instance Method Details

#add_comment(comment) ⇒ Object



29
30
31
# File 'lib/commenter/comment_sheet.rb', line 29

def add_comment(comment)
  self.comments = (comments || []) + [comment.is_a?(Comment) ? comment : Comment.from_hash(comment)]
end

#schema_nameObject



33
34
35
# File 'lib/commenter/comment_sheet.rb', line 33

def schema_name
  version == "osd" ? "iso_comment_osd.yaml" : "iso_comment_2012-03.yaml"
end

#to_hObject



45
46
47
# File 'lib/commenter/comment_sheet.rb', line 45

def to_h
  CommentSheet.to_hash(self)
end

#to_yaml_document(schema_dir = "schema") ⇒ Object



37
38
39
# File 'lib/commenter/comment_sheet.rb', line 37

def to_yaml_document(schema_dir = "schema")
  "# yaml-language-server: $schema=#{File.join(schema_dir.to_s, schema_name)}\n\n#{to_yaml}"
end

#to_yaml_hObject



41
42
43
# File 'lib/commenter/comment_sheet.rb', line 41

def to_yaml_h
  CommentSheet.to_hash(self)
end