Class: Eco::API::UseCases::GraphQL::Samples::Pages::Template::Base

Inherits:
Base show all
Defined in:
lib/eco/api/usecases/graphql/samples/pages/template/base.rb

Instance Attribute Summary

Attributes included from Lib::ErrorHandling

#exception, #exiting

Attributes included from Language::AuxiliarLogger

#logger

Instance Method Summary collapse

Methods inherited from Base

#main

Methods included from Language::Methods::CallDetector

#called_via?

Methods included from Language::AuxiliarLogger

#log

Methods inherited from Common::Loaders::UseCase

#cli_apply!, #initialize, #main

Methods included from Common::Loaders::UseCase::CliIdentify

#cli, #cli!

Methods included from Common::Loaders::UseCase::TargetModel

included, #target_model

Methods included from Common::Loaders::UseCase::Type

included, #type

Methods inherited from Common::Loaders::CaseBase

#name, name_only_once!, original_name

Constructor Details

This class inherits a constructor from Eco::API::Common::Loaders::UseCase

Instance Method Details

#declare(_emitter) ⇒ Object

Declare the desired template structure onto the given CommandEmitter.

Raises:

  • (NotImplementedError)


46
47
48
# File 'lib/eco/api/usecases/graphql/samples/pages/template/base.rb', line 46

def declare(_emitter)
  raise NotImplementedError, "Implement #declare(emitter) in #{self.class}"
end

#desired_commandsObject

The ordered command batch this template would apply. Pure — no client needed.



51
52
53
54
55
# File 'lib/eco/api/usecases/graphql/samples/pages/template/base.rb', line 51

def desired_commands
  emitter = CommandEmitter.new
  declare(emitter)
  emitter.commands
end

#processObject



34
35
36
37
38
39
40
41
# File 'lib/eco/api/usecases/graphql/samples/pages/template/base.rb', line 34

def process
  commands = desired_commands
  if simulate?
    log(:info) { preview_message(commands) }
    return nil
  end
  apply(commands)
end