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

Inherits:
Object
  • Object
show all
Defined in:
lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart.rb,
lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code.rb,
lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/settings.rb,
lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/template.rb,
lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code/commands/generate_lines.rb,
lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code/commands/generate_result_lines.rb,
lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code/commands/generate_service_lines.rb,
lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code/commands/generate_method_step_lines.rb,
lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code/commands/generate_service_step_lines.rb

Defined Under Namespace

Modules: Entities

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service:) ⇒ void

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:



25
26
27
# File 'lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart.rb', line 25

def initialize(service:)
  @service = service
end

Instance Attribute Details

#serviceObject (readonly)

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.



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

def service
  @service
end

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)


96
97
98
99
100
101
102
# File 'lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart.rb', line 96

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

  return false if service != other.service

  true
end

#codeConvenientService::Service::Plugins::HasMermaidFlowchart::Entities::Code

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:

  • (ConvenientService::Service::Plugins::HasMermaidFlowchart::Entities::Code)


55
56
57
# File 'lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart.rb', line 55

def code
  @code ||= Entities::Code.new(flowchart: self)
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)


34
35
36
# File 'lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart.rb', line 34

def content
  template.render(**replacements)
end

#replacementsHash{Symbol => Object}

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:

  • (Hash{Symbol => Object})


43
44
45
46
47
48
# File 'lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart.rb', line 43

def replacements
  {
    title: settings.title,
    code: code.generate
  }
end

#saveBoolean

Returns:

  • (Boolean)


85
86
87
88
# File 'lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart.rb', line 85

def save
  ::File.write(settings.absolute_path, content)
    .tap { ConvenientService.logger.info { "[HasMermaidFlowchart] Flowchart is saved into `#{settings.absolute_path}` " } }
end

#settingsConvenientService::Service::Plugins::HasMermaidFlowchart::Entities::Settings

Returns:

  • (ConvenientService::Service::Plugins::HasMermaidFlowchart::Entities::Settings)


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

def settings
  @settings ||= Entities::Settings.new(flowchart: self)
end

#templateConvenientService::Service::Plugins::HasMermaidFlowchart::Entities::Template

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:

  • (ConvenientService::Service::Plugins::HasMermaidFlowchart::Entities::Template)


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

def template
  @template ||= Entities::Template.new
end