Class: ConvenientService::Service::Plugins::HasMermaidFlowchart::Entities::Flowchart::Entities::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/template.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Boolean?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • other (Object)

Returns:

  • (Boolean, nil)


73
74
75
76
77
# File 'lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/template.rb', line 73

def ==(other)
  return unless other.instance_of?(self.class)

  true
end

#absolute_pathString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


29
30
31
# File 'lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/template.rb', line 29

def absolute_path
  @absolute_path ||= ::File.expand_path(relative_path, __dir__)
end

#contentString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


47
48
49
# File 'lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/template.rb', line 47

def content
  @content ||= ::File.read(absolute_path)
end

#erbERB

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (ERB)


38
39
40
# File 'lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/template.rb', line 38

def erb
  @erb ||= ::ERB.new(content)
end

#relative_pathString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


16
17
18
# File 'lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/template.rb', line 16

def relative_path
  @relative_path ||= ::File.join("..", "templates", "flowchart.html.erb")
end

#render(**replacements) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • replacements (Hash{Symbol => Object})

Returns:

  • (String)

See Also:



63
64
65
# File 'lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/template.rb', line 63

def render(**replacements)
  erb.result_with_hash(replacements)
end