class Spoonerize::Web
Sinatra app for spoonerizing phrases in the browser.
Constants
- OPTION_NAMES
-
Boolean
Spoonerismoptions exposed by the web form.@return [Array<String>]
Public Instance Methods
Source
# File lib/spoonerize/web.rb, line 34 def checked?(name) option_value(name) ? "checked" : nil end
HTML checkbox attribute for a truthy option value.
@param [String] name The option name.
@return [String, nil]
Source
# File lib/spoonerize/web.rb, line 54 def h(value) Rack::Utils.escape_html(value) end
Escapes a value for safe HTML output.
@param [Object] value The value to escape.
@return [String]
Source
# File lib/spoonerize/web.rb, line 44 def option_value(name) @options.fetch(name.to_sym) end
Current boolean value for a web form option.
@param [String] name The option name.
@return [Boolean]
Source
# File lib/spoonerize/web.rb, line 65 def saved_entry_path(phrase, result) "/?#{Rack::Utils.build_query("phrase" => phrase, "result" => result)}" end
Path for loading a saved spoonerism on the main web form.
@param [String] phrase The original phrase. @param [String] result The saved spoonerized result.
@return [String]