Class: Launchy::Argv

Inherits:
Object
  • Object
show all
Defined in:
lib/launchy/argv.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Argv

Returns a new instance of Argv.



4
5
6
# File 'lib/launchy/argv.rb', line 4

def initialize( *args )
  @argv = args.flatten
end

Instance Attribute Details

#argvObject (readonly)

Returns the value of attribute argv.



3
4
5
# File 'lib/launchy/argv.rb', line 3

def argv
  @argv
end

Instance Method Details

#==(other) ⇒ Object



32
33
34
# File 'lib/launchy/argv.rb', line 32

def ==( other )
  @argv == other.argv
end

#[](idx) ⇒ Object



16
17
18
# File 'lib/launchy/argv.rb', line 16

def [](idx)
  @argv[idx]
end

#blank?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/launchy/argv.rb', line 24

def blank?
  @argv.empty? || (@argv.first.strip.size == 0)
end

#executable?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/launchy/argv.rb', line 28

def executable?
  ::Launchy::Application.find_executable( @argv.first )
end

#to_sObject



8
9
10
# File 'lib/launchy/argv.rb', line 8

def to_s
  @argv.join(' ')
end

#to_strObject



12
13
14
# File 'lib/launchy/argv.rb', line 12

def to_str
  to_s
end

#valid?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/launchy/argv.rb', line 20

def valid?
  (not blank?) && executable?
end