Class: Proctor::Presenter::List
- Inherits:
-
Object
- Object
- Proctor::Presenter::List
- Defined in:
- lib/proctor/presenter/list.rb
Instance Method Summary collapse
- #handle(string) ⇒ Object
-
#initialize(global, options, args) ⇒ List
constructor
A new instance of List.
- #puts_handle(string) ⇒ Object
- #render ⇒ Object
- #render_all ⇒ Object
- #render_appfiles ⇒ Object
- #render_managers ⇒ Object
- #render_node ⇒ Object
- #render_services ⇒ Object
- #render_templates ⇒ Object
Constructor Details
#initialize(global, options, args) ⇒ List
Returns a new instance of List.
7 8 9 10 11 |
# File 'lib/proctor/presenter/list.rb', line 7 def initialize(global, , args) @global = global @options = @args = args end |
Instance Method Details
#handle(string) ⇒ Object
24 25 26 |
# File 'lib/proctor/presenter/list.rb', line 24 def handle(string) Digest::MD5.hexdigest(string)[0..2] end |
#puts_handle(string) ⇒ Object
28 29 30 |
# File 'lib/proctor/presenter/list.rb', line 28 def puts_handle(string) puts "#{handle(string)}: #{string}" end |
#render ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/proctor/presenter/list.rb', line 13 def render case @options[:type] when "appfiles" then render_appfiles when "managers" then render_managers when "services" then render_services when "templates" then render_templates when "node" then render_node when "all" then render_all end end |
#render_all ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/proctor/presenter/list.rb', line 57 def render_all render_templates render_appfiles render_managers render_services render_node end |
#render_appfiles ⇒ Object
37 38 39 40 |
# File 'lib/proctor/presenter/list.rb', line 37 def render_appfiles puts "[AppFiles]" CmdState.app_files(@global, @options, @args).each { |f| puts "#{handle(f)}: #{f}" } end |
#render_managers ⇒ Object
42 43 44 45 |
# File 'lib/proctor/presenter/list.rb', line 42 def render_managers puts "[Managers]" CmdState.managers(@global, @options, @args).keys.each {|k| puts_handle(k)} end |
#render_node ⇒ Object
52 53 54 55 |
# File 'lib/proctor/presenter/list.rb', line 52 def render_node puts "[Nodes]" CmdState.nodes(@global, @options, @args).keys.each {|k| puts_handle(k)} end |