Class: String

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

Instance Method Summary collapse

Instance Method Details

#funcall_styleObject



28
29
30
# File 'lib/mkmf.rb', line 28

def funcall_style
  /\)\z/ =~ self ? dup : "#{self}()"
end

#quoteObject

Wraps a string in escaped quotes if it contains whitespace.



14
15
16
# File 'lib/mkmf.rb', line 14

def quote
  /\s/ =~ self ? "\"#{self}\"" : "#{self}"
end

#sans_argumentsObject



32
33
34
# File 'lib/mkmf.rb', line 32

def sans_arguments
  self[/\A[^()]+/]
end

#tr_cppObject

Generates a string used as cpp macro name.



24
25
26
# File 'lib/mkmf.rb', line 24

def tr_cpp
  strip.upcase.tr_s("^A-Z0-9_*", "_").tr_s("*", "P")
end

#unspaceObject

Escape whitespaces for Makefile.



19
20
21
# File 'lib/mkmf.rb', line 19

def unspace
  gsub(/\s/, '\\\\\\&')
end