Class: SnippetCli::WizardContext

Inherits:
Data
  • Object
show all
Defined in:
lib/snippet_cli/wizard_context.rb

Overview

Carries shared wizard configuration: which file to save to, which global var names are already declared in that file, and the pipe IO for structured output when stdout is redirected. Passed explicitly rather than communicated via global state.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(global_var_names: [], save_path: nil, pipe_output: nil) ⇒ WizardContext

Returns a new instance of WizardContext.



9
10
11
# File 'lib/snippet_cli/wizard_context.rb', line 9

def initialize(global_var_names: [], save_path: nil, pipe_output: nil)
  super
end

Instance Attribute Details

#global_var_namesObject (readonly)

Returns the value of attribute global_var_names

Returns:

  • (Object)

    the current value of global_var_names



8
9
10
# File 'lib/snippet_cli/wizard_context.rb', line 8

def global_var_names
  @global_var_names
end

#pipe_outputObject (readonly)

Returns the value of attribute pipe_output

Returns:

  • (Object)

    the current value of pipe_output



8
9
10
# File 'lib/snippet_cli/wizard_context.rb', line 8

def pipe_output
  @pipe_output
end

#save_pathObject (readonly)

Returns the value of attribute save_path

Returns:

  • (Object)

    the current value of save_path



8
9
10
# File 'lib/snippet_cli/wizard_context.rb', line 8

def save_path
  @save_path
end