Class: Hscode::CliController
- Inherits:
-
Object
- Object
- Hscode::CliController
- Defined in:
- lib/hscode.rb
Class Method Summary collapse
Class Method Details
.call(args) ⇒ Object
10 11 12 13 |
# File 'lib/hscode.rb', line 10 def self.call(args) = Hscode::InputParser.new.parse(args) print_code() end |
.print_code(options) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/hscode.rb', line 17 def self.print_code() status_code = HTTP_STATUS_CODES[.status_code.to_i] unless status_code puts "#{.status_code} is not a valid code. See 'hscode --help'." exit 1 end PrettyPrint.print( "#{.status_code} - #{status_code[:title]}", .status_code.to_s[0] ) print_description(status_code) if .verbose end |
.print_description(status_code) ⇒ Object
32 33 34 35 36 |
# File 'lib/hscode.rb', line 32 def self.print_description(status_code) status_code[:description].each do |desc| PrettyPrint.print("\n#{desc}", '0') end end |