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

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

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

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:



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

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.



22
23
24
# File 'lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart.rb', line 22

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)


101
102
103
104
105
106
107
# File 'lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart.rb', line 101

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)


60
61
62
# File 'lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart.rb', line 60

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)


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

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})


48
49
50
51
52
53
# File 'lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart.rb', line 48

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

#saveBoolean

Returns:

  • (Boolean)


90
91
92
93
# File 'lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart.rb', line 90

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)


69
70
71
# File 'lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart.rb', line 69

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)


78
79
80
# File 'lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart.rb', line 78

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