Class: Usher::Util::Generators::URL::UrlParts
- Inherits:
-
Struct
- Object
- Struct
- Usher::Util::Generators::URL::UrlParts
- Defined in:
- lib/usher/util/generate.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
-
#request ⇒ Object
Returns the value of attribute request.
Instance Method Summary collapse
- #host ⇒ Object
- #port ⇒ Object
- #port_string ⇒ Object
- #protocol ⇒ Object
- #scheme ⇒ Object
- #url ⇒ Object
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path
25 26 27 |
# File 'lib/usher/util/generate.rb', line 25 def path @path end |
#request ⇒ Object
Returns the value of attribute request
25 26 27 |
# File 'lib/usher/util/generate.rb', line 25 def request @request end |
Instance Method Details
#host ⇒ Object
34 35 36 |
# File 'lib/usher/util/generate.rb', line 34 def host @host ||= generate_with(:host) || request.host end |
#port ⇒ Object
38 39 40 |
# File 'lib/usher/util/generate.rb', line 38 def port @port ||= generate_with(:port) || request.port end |
#port_string ⇒ Object
42 43 44 |
# File 'lib/usher/util/generate.rb', line 42 def port_string @port_string ||= standard_port? ? '' : ":#{port}" end |
#protocol ⇒ Object
30 31 32 |
# File 'lib/usher/util/generate.rb', line 30 def protocol @protocol ||= scheme ? "#{scheme}://" : request.protocol end |
#scheme ⇒ Object
26 27 28 |
# File 'lib/usher/util/generate.rb', line 26 def scheme @scheme ||= generate_with(:scheme) || (request.respond_to?(:scheme) and request.scheme) end |
#url ⇒ Object
46 47 48 49 50 |
# File 'lib/usher/util/generate.rb', line 46 def url path.route.generate_with.nil? || path.route.generate_with.empty? ? request.url : protocol + host + port_string end |