Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/webconsole/lib/module.rb,
lib/webconsole/lib/view/javascript.rb
Instance Method Summary collapse
- #is_float? ⇒ Boolean
- #is_integer? ⇒ Boolean
- #javascript_argument ⇒ Object
- #javascript_escape ⇒ Object
- #javascript_escape! ⇒ Object
- #shell_escape ⇒ Object
- #shell_escape! ⇒ Object
Instance Method Details
#is_float? ⇒ Boolean
107 108 109 |
# File 'lib/webconsole/lib/module.rb', line 107 def is_float? true if Float(self) rescue false end |
#is_integer? ⇒ Boolean
111 112 113 |
# File 'lib/webconsole/lib/module.rb', line 111 def is_integer? self.to_i.to_s == self end |
#javascript_argument ⇒ Object
31 32 33 |
# File 'lib/webconsole/lib/view/javascript.rb', line 31 def javascript_argument "'#{self.javascript_escape}'" end |
#javascript_escape ⇒ Object
35 36 37 |
# File 'lib/webconsole/lib/view/javascript.rb', line 35 def javascript_escape self.gsub('\\', "\\\\\\\\").gsub("\n", "\\\\n").gsub("'", "\\\\'") end |
#javascript_escape! ⇒ Object
39 40 41 |
# File 'lib/webconsole/lib/view/javascript.rb', line 39 def javascript_escape! replace(self.javascript_escape) end |
#shell_escape ⇒ Object
115 116 117 |
# File 'lib/webconsole/lib/module.rb', line 115 def shell_escape Shellwords.escape(self) end |
#shell_escape! ⇒ Object
119 120 121 |
# File 'lib/webconsole/lib/module.rb', line 119 def shell_escape! replace(shell_escape) end |