Module: Console::Mux::Util
- Included in:
- Command
- Defined in:
- lib/console/mux/util.rb
Instance Method Summary collapse
- 
  
    
      #auto_name(str)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Strip any file extension from the file basename from the first word of str.
- 
  
    
      #basename(str)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    File.basename. 
- 
  
    
      #chop_file_extension(str)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Return strwith the last file extension (.something) removed.
- 
  
    
      #first_word(str)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Fetch the first word from a string of space-separated words. 
Instance Method Details
#auto_name(str) ⇒ Object
Strip any file extension from the file basename from the first word of str.
| 48 49 50 51 52 53 | # File 'lib/console/mux/util.rb', line 48 def auto_name(str) compose([:first_word, :basename, :chop_file_extension], str) end | 
#basename(str) ⇒ Object
File.basename
| 42 43 44 | # File 'lib/console/mux/util.rb', line 42 def basename(str) File.basename(str) end | 
#chop_file_extension(str) ⇒ Object
Return str with the last file extension (.something) removed.
| 33 34 35 36 37 38 39 | # File 'lib/console/mux/util.rb', line 33 def chop_file_extension(str) if str =~ /(.*)\.\w+$/ $1 else str end end | 
#first_word(str) ⇒ Object
Fetch the first word from a string of space-separated words.
| 27 28 29 | # File 'lib/console/mux/util.rb', line 27 def first_word(str) str.split[0] end |