Class: Repla::Dependencies::Controller

Inherits:
Controller
  • Object
show all
Defined in:
lib/repla/dependencies/lib/controller.rb

Overview

Dependencies controller

Instance Attribute Summary

Attributes inherited from Controller

#view

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeController

Returns a new instance of Controller.



9
10
11
# File 'lib/repla/dependencies/lib/controller.rb', line 9

def initialize
  @view = View.new
end

Class Method Details

.string_for_type(type) ⇒ Object

TODO: self.string_for_type should be private but now all of a sudden instances method can’t call private class methods?



25
26
27
28
29
30
31
# File 'lib/repla/dependencies/lib/controller.rb', line 25

def self.string_for_type(type)
  case type
  when :shell_command
    return 'shell command'
  end
  nil
end

Instance Method Details

#missing_dependency(dependency) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/repla/dependencies/lib/controller.rb', line 13

def missing_dependency(dependency)
  name = dependency.name
  type = self.class.string_for_type(dependency.type)
  options = dependency.options
  if options.key?(:installation_instructions)
    installation_instructions = options[:installation_instructions]
  end
  @view.add_missing_dependency(name, type, installation_instructions)
end