Class: Launchy::Argv
- Inherits:
-
Object
- Object
- Launchy::Argv
- Defined in:
- lib/launchy/argv.rb
Instance Attribute Summary collapse
-
#argv ⇒ Object
readonly
Returns the value of attribute argv.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #[](idx) ⇒ Object
- #blank? ⇒ Boolean
- #executable? ⇒ Boolean
-
#initialize(*args) ⇒ Argv
constructor
A new instance of Argv.
- #to_s ⇒ Object
- #to_str ⇒ Object
- #valid? ⇒ Boolean
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
#argv ⇒ Object (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
24 25 26 |
# File 'lib/launchy/argv.rb', line 24 def blank? @argv.empty? || (@argv.first.strip.size == 0) end |
#executable? ⇒ Boolean
28 29 30 |
# File 'lib/launchy/argv.rb', line 28 def executable? ::Launchy::Application.find_executable( @argv.first ) end |
#to_s ⇒ Object
8 9 10 |
# File 'lib/launchy/argv.rb', line 8 def to_s @argv.join(' ') end |
#to_str ⇒ Object
12 13 14 |
# File 'lib/launchy/argv.rb', line 12 def to_str to_s end |
#valid? ⇒ Boolean
20 21 22 |
# File 'lib/launchy/argv.rb', line 20 def valid? (not blank?) && executable? end |