Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/miga/common.rb

Overview

MiGA extensions to the String class.

Instance Method Summary collapse

Instance Method Details

#miga_nameObject

Replace any character not allowed in a MiGA name for underscore (_). This results in a MiGA-compliant name EXCEPT for empty strings, that results in empty strings.


122
# File 'lib/miga/common.rb', line 122

def miga_name ; gsub(/[^A-Za-z0-9_]/, "_") ; end

#miga_name?Boolean

Is the string a MiGA-compliant name?

Returns:

  • (Boolean)

126
# File 'lib/miga/common.rb', line 126

def miga_name? ; not(self !~ /^[A-Za-z0-9_]+$/) ; end

#unmiga_nameObject

Replace underscores by spaces.


130
# File 'lib/miga/common.rb', line 130

def unmiga_name ; tr("_", " ") ; end