class Aio::Ui::Banner

Attributes

compare[RW]
input[RW]
input_style[RW]
mode[RW]
output[RW]
output_style[RW]
ranking[RW]
type[RW]

Public Class Methods

new() click to toggle source
# File lib/aio/ui/banner.rb, line 32
def initialize
        @type = ""
end

Public Instance Methods

banner() click to toggle source
check(opt) click to toggle source

检查参数是否合法

# File lib/aio/ui/banner.rb, line 68
def check(opt)
        opt = opt.to_s
        if opt.empty? and opt =~ /-/
                banner
        end

        return opt
end
has_input?() click to toggle source

判断是否有 input 信息

# File lib/aio/ui/banner.rb, line 78
def has_input?
        return false if @input_style.nil? and @input.nil?
        return true
end
parse(args=[]) click to toggle source
# File lib/aio/ui/banner.rb, line 36
def parse(args=[])
        banner if args.empty?

        while(!args.empty?) do 
                arg = args.shift
                case arg
                when "-l", "--list"
                        @type = args.shift unless args[0] =~ /-/
                        self.mode = 0
                when "-is", "--inupt-style"
                        @input_style = check(args.shift)
                        self.mode = 1
                when "-i", "--input"
                        @input = check(args.shift)
                when "-r", "--ranking"
                        @ranking = check(args.shift)
                when "-c", "--compare"
                        @compare = check(args.shift)
                when "-os", "--output-style"
                        @output_style = check(args.shift)
                        self.mode = 1
                when "-o", "--output"
                        @output = check(args.shift)
                when "-h", "--help"
                        banner
                end
        end

        self
end