Class: Picobox::Box

Inherits:
Object
  • Object
show all
Includes:
Utils::Output, Utils::Visitable
Defined in:
lib/picobox/box.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::Output

#display_error, #display_info, #display_line, #display_status

Methods included from Utils::Visitable

#accept

Constructor Details

#initialize(os) ⇒ Box

Returns a new instance of Box.



8
9
10
# File 'lib/picobox/box.rb', line 8

def initialize(os)
  @os = os
end

Instance Attribute Details

#osObject (readonly)

Returns the value of attribute os.



6
7
8
# File 'lib/picobox/box.rb', line 6

def os
  @os
end

Instance Method Details

#install(type = nil) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/picobox/box.rb', line 12

def install(type = nil)
  return if type.nil?
  accept(Commands::AddBox.new(type))
rescue Errors::BoxNotImplemented
  display_box_not_available type
  list # called like for exception handling
rescue StandardError => e
  display_error e
  exit 1
end

#listObject



23
24
25
26
27
28
29
# File 'lib/picobox/box.rb', line 23

def list()
  accept(Commands::UpdatePackages.new)
  accept(Commands::ListBoxes.new)
rescue StandardError => e
  display_error e
  exit 1
end