Class: Cl::Ui::Base

Inherits:
Struct
  • Object
show all
Defined in:
lib/cl/ui.rb

Direct Known Subclasses

Pipe, Silent, Test, Tty

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optsObject

Returns the value of attribute opts

Returns:

  • (Object)

    the current value of opts


13
14
15
# File 'lib/cl/ui.rb', line 13

def opts
  @opts
end

#stdoutObject


16
17
18
# File 'lib/cl/ui.rb', line 16

def stdout
  @stdout ||= opts[:stdout] || $stdout
end

Instance Method Details

#abort(error, *strs) ⇒ Object


24
25
26
27
# File 'lib/cl/ui.rb', line 24

def abort(error, *strs)
  self.error [error.message, *strs].join("\n\n")
  exit 1
end

#puts(*strs) ⇒ Object


20
21
22
# File 'lib/cl/ui.rb', line 20

def puts(*strs)
  stdout.puts(*strs)
end