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.
# File lib/miga/common/format.rb, line 118 def miga_name gsub(/[^A-Za-z0-9_]/, '_') end
Is the string a MiGA-compliant name?
# File lib/miga/common/format.rb, line 124 def miga_name? !(self !~ /^[A-Za-z0-9_]+$/) end
Replace underscores by spaces or dots (depending on context).
# File lib/miga/common/format.rb, line 130 def unmiga_name gsub(/_(str|sp|subsp|pv)__/, '_\1._').tr('_', ' ') end
Wraps the string with fixed Integer width
.
# File lib/miga/common/format.rb, line 136 def wrap_width(width) gsub(/([^\n\r]{1,#{width}})/, "\\1\n") end