Class: BibTeX::Comment

Inherits:
Element show all
Defined in:
lib/bibtex/elements.rb

Overview

Represents a @comment object.

Direct Known Subclasses

MetaComment

Instance Attribute Summary

Attributes inherited from Element

#bibliography

Instance Method Summary collapse

Methods inherited from Element

#added_to_bibliography, #removed_from_bibliography, #to_hash, #to_json, #to_xml, #to_yaml

Constructor Details

#initialize(content = '') ⇒ Comment

Returns a new instance of Comment.



229
230
231
# File 'lib/bibtex/elements.rb', line 229

def initialize(content='')
	self.content = content
end

Instance Method Details

#contentObject



238
239
240
# File 'lib/bibtex/elements.rb', line 238

def content
	@content
end

#content=(content) ⇒ Object

Raises:

  • (ArgumentError)


233
234
235
236
# File 'lib/bibtex/elements.rb', line 233

def content=(content)
	raise(ArgumentError, "BibTeX::#{self.class.name} content must be of type String; was: #{content.class.name}.") unless content.kind_of?(::String)
	@content = content
end

#to_sObject



242
243
244
# File 'lib/bibtex/elements.rb', line 242

def to_s
	['@comment{ ',content,'}'].join
end