Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/buildizer/core_ext/string.rb

Instance Method Summary collapse

Instance Method Details

#match_glob?(glob) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/buildizer/core_ext/string.rb', line 6

def match_glob?(glob)
  File.fnmatch? glob, self, File::FNM_EXTGLOB
end

#off?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/buildizer/core_ext/string.rb', line 14

def off?
  !on?
end

#on?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/buildizer/core_ext/string.rb', line 10

def on?
  ['1', 'true', 'yes'].include? self.downcase
end

#underscoreObject



2
3
4
# File 'lib/buildizer/core_ext/string.rb', line 2

def underscore
  self.gsub(/(.)([A-Z])/,'\1_\2').downcase
end