Class: EJX::Template::HTMLComment

Inherits:
Object
  • Object
show all
Defined in:
lib/ejx/template/html_comment.rb

Instance Method Summary collapse

Constructor Details

#initialize(comment) ⇒ HTMLComment

Returns a new instance of HTMLComment.



3
4
5
# File 'lib/ejx/template/html_comment.rb', line 3

def initialize(comment)
  @comment = comment
end

Instance Method Details

#inspectObject



11
12
13
# File 'lib/ejx/template/html_comment.rb', line 11

def inspect
  "#<EJX::HTMLComment:#{self.object_id} @comment=#{@comment}>"
end

#to_js(append: "__output", var_generator:, indentation: 4, namespace: nil) ⇒ Object



15
16
17
# File 'lib/ejx/template/html_comment.rb', line 15

def to_js(append: "__output", var_generator:, indentation: 4, namespace: nil)
  "#{' '*indentation}#{append}.push(document.createComment(#{JSON.generate(@comment)}));\n"
end

#to_sObject



7
8
9
# File 'lib/ejx/template/html_comment.rb', line 7

def to_s
  @comment
end