Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/mkmf.rb
Instance Method Summary collapse
- #funcall_style ⇒ Object
-
#quote ⇒ Object
Wraps a string in escaped quotes if it contains whitespace.
- #sans_arguments ⇒ Object
-
#tr_cpp ⇒ Object
Generates a string used as cpp macro name.
-
#unspace ⇒ Object
Escape whitespaces for Makefile.
Instance Method Details
#funcall_style ⇒ Object
28 29 30 |
# File 'lib/mkmf.rb', line 28 def funcall_style /\)\z/ =~ self ? dup : "#{self}()" end |
#quote ⇒ Object
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_arguments ⇒ Object
32 33 34 |
# File 'lib/mkmf.rb', line 32 def sans_arguments self[/\A[^()]+/] end |
#tr_cpp ⇒ Object
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 |
#unspace ⇒ Object
Escape whitespaces for Makefile.
19 20 21 |
# File 'lib/mkmf.rb', line 19 def unspace gsub(/\s/, '\\\\\\&') end |