Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/filebase.rb,
lib/extentions/string.rb

Instance Method Summary collapse

Instance Method Details

#as_extObject



6
# File 'lib/filebase.rb', line 6

def as_ext; self[0,0]='.' unless self[0,1]=='.'|| self==''; self end

#as_fileObject



4
# File 'lib/filebase.rb', line 4

def as_file; self.gsub(/([!?,]|[^a-zA-Z0-9]$)/, '').gsub(/[^a-zA-Z0-9\/\.]/, '_').downcase end

#as_file_titleObject



7
# File 'lib/filebase.rb', line 7

def as_file_title; self.as_file.gsub /_/, ' ' end

#as_folderObject



5
# File 'lib/filebase.rb', line 5

def as_folder; (self=~/^[\. \/]{1,2}$/ ? './' : (self.as_file+((self.as_file=~/\/$/||self=='') ? '' : '/'))) end

#as_symbolObject



8
# File 'lib/filebase.rb', line 8

def as_symbol; self.as_file.to_sym end

#flag?Boolean

Returns:

  • (Boolean)


2
# File 'lib/extentions/string.rb', line 2

def flag?; self[0,1]=='-' end

#shiftObject



3
# File 'lib/extentions/string.rb', line 3

def shift; self.slice! 0,1 end