Sha256: bd72247622e8ee5e81dd4357916e79c647efad3f6510e25bc4c465e2fcb0ef8d

Contents?: true

Size: 458 Bytes

Versions: 26

Compression:

Stored size: 458 Bytes

Contents

module Tw::App
  class Main
    def username?(arg)
      arg =~ /^@[a-zA-Z0-9_]+$/ ? arg.scan(/^@([a-zA-Z0-9_]+)$/)[0][0] : false
    end
    
    def listname?(arg)
      arg =~ /^@[a-zA-Z0-9_]+\/[a-zA-Z0-9_]+$/ ? arg.scan(/^@([a-zA-Z0-9_]+)\/([a-zA-Z0-9_]+)$/)[0] : false
    end

    def request?(arg)
      username?(arg) or listname?(arg)
    end
    
    def all_requests?(args)
      !args.map{|arg| request? arg}.include?(false)
    end
  end  
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
tw-0.2.1 lib/tw/app/opt_parser.rb
tw-0.2.0 lib/tw/app/opt_parser.rb
tw-0.1.1 lib/tw/app/opt_parser.rb
tw-0.1.0 lib/tw/app/opt_parser.rb
tw-0.0.3 lib/tw/app/opt_parser.rb
tw-0.0.2 lib/tw/app/opt_parser.rb