Class: Structurizr::REPL::Application
- Inherits:
-
Object
- Object
- Structurizr::REPL::Application
- Defined in:
- lib/structurizr/repl.rb
Instance Attribute Summary collapse
-
#argv ⇒ Object
readonly
Returns the value of attribute argv.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#workspace_path ⇒ Object
readonly
Returns the value of attribute workspace_path.
Instance Method Summary collapse
-
#initialize(argv) ⇒ Application
constructor
A new instance of Application.
- #parse_workspace_path! ⇒ Object
- #prepare_context! ⇒ Object
- #setup_pry! ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(argv) ⇒ Application
Returns a new instance of Application.
37 38 39 |
# File 'lib/structurizr/repl.rb', line 37 def initialize(argv) @argv = argv end |
Instance Attribute Details
#argv ⇒ Object (readonly)
Returns the value of attribute argv.
35 36 37 |
# File 'lib/structurizr/repl.rb', line 35 def argv @argv end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
35 36 37 |
# File 'lib/structurizr/repl.rb', line 35 def context @context end |
#workspace_path ⇒ Object (readonly)
Returns the value of attribute workspace_path.
35 36 37 |
# File 'lib/structurizr/repl.rb', line 35 def workspace_path @workspace_path end |
Instance Method Details
#parse_workspace_path! ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/structurizr/repl.rb', line 41 def parse_workspace_path! @workspace_path = if (input_path = argv.first) && File.file?(input_path) argv.first else puts 'Usage: structurizr-repl <path/to/structurizr.json>' raise InvalidWorkspaceFileError, 'Please specify a valid path' end end |
#prepare_context! ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/structurizr/repl.rb', line 52 def prepare_context! @context = Structurizr::REPL::Context.new( Structurizr::Workspace.from_json( File.read(workspace_path) ) ) end |
#setup_pry! ⇒ Object
60 61 62 63 |
# File 'lib/structurizr/repl.rb', line 60 def setup_pry! register_commands end |
#start ⇒ Object
65 66 67 |
# File 'lib/structurizr/repl.rb', line 65 def start Pry.start(context) end |