Module: Spec::Fixture::Filter
- Defined in:
- lib/spec/fixture/filter.rb
Class Method Summary collapse
- .base64_decode(str) ⇒ Object
- .base64_encode(str) ⇒ Object
- .eval(str) ⇒ Object
- .html_escape(str) ⇒ Object
- .html_unescape(str) ⇒ Object
- .pathname(str) ⇒ Object
- .timep(str) ⇒ Object
- .uri(str) ⇒ Object
- .uri_decode(str) ⇒ Object
- .uri_encode(str) ⇒ Object
Class Method Details
.base64_decode(str) ⇒ Object
51 52 53 54 |
# File 'lib/spec/fixture/filter.rb', line 51 def base64_decode str require 'base64' Base64.decode64(str.to_s) end |
.base64_encode(str) ⇒ Object
46 47 48 49 |
# File 'lib/spec/fixture/filter.rb', line 46 def base64_encode str require 'base64' Base64.encode64(str.to_s) end |
.eval(str) ⇒ Object
7 8 9 |
# File 'lib/spec/fixture/filter.rb', line 7 def eval str eval(str.to_s) end |
.html_escape(str) ⇒ Object
16 17 18 19 |
# File 'lib/spec/fixture/filter.rb', line 16 def html_escape str require 'cgi' CGI.escapeHTML(str.to_s) end |
.html_unescape(str) ⇒ Object
21 22 23 24 |
# File 'lib/spec/fixture/filter.rb', line 21 def html_unescape str require 'cgi' CGI.unescapeHTML(str.to_s) end |
.pathname(str) ⇒ Object
26 27 28 29 |
# File 'lib/spec/fixture/filter.rb', line 26 def pathname str require 'pathname' Pathname.new(str.to_s) end |
.timep(str) ⇒ Object
11 12 13 14 |
# File 'lib/spec/fixture/filter.rb', line 11 def timep str require 'time' Time.parse(str.to_s) end |
.uri(str) ⇒ Object
31 32 33 34 |
# File 'lib/spec/fixture/filter.rb', line 31 def uri str require 'uri' URI.new(str.to_s) end |
.uri_decode(str) ⇒ Object
41 42 43 44 |
# File 'lib/spec/fixture/filter.rb', line 41 def uri_decode str require 'uri' URI.decode(str.to_s) end |
.uri_encode(str) ⇒ Object
36 37 38 39 |
# File 'lib/spec/fixture/filter.rb', line 36 def uri_encode str require 'uri' URI.encode(str.to_s) end |