Class: Commenter::CommentSheet
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Commenter::CommentSheet
- 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
- #add_comment(comment) ⇒ Object
- #schema_name ⇒ Object
- #to_h ⇒ Object
- #to_yaml_document(schema_dir = "schema") ⇒ Object
- #to_yaml_h ⇒ Object
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_name ⇒ Object
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_h ⇒ Object
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_h ⇒ Object
41 42 43 |
# File 'lib/commenter/comment_sheet.rb', line 41 def to_yaml_h CommentSheet.to_hash(self) end |