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
41 42 43 |
# File 'lib/usher/util/generate.rb', line 41 def path @path end |
#request ⇒ Object
Returns the value of attribute request
41 42 43 |
# File 'lib/usher/util/generate.rb', line 41 def request @request end |
Instance Method Details
#host ⇒ Object
50 51 52 |
# File 'lib/usher/util/generate.rb', line 50 def host @host ||= generate_with(:host) || request.host end |
#port ⇒ Object
54 55 56 |
# File 'lib/usher/util/generate.rb', line 54 def port @port ||= generate_with(:port) || request.port end |
#port_string ⇒ Object
58 59 60 |
# File 'lib/usher/util/generate.rb', line 58 def port_string @port_string ||= standard_port? ? '' : ":#{port}" end |
#protocol ⇒ Object
46 47 48 |
# File 'lib/usher/util/generate.rb', line 46 def protocol @protocol ||= scheme ? "#{scheme}://" : request.protocol end |
#scheme ⇒ Object
42 43 44 |
# File 'lib/usher/util/generate.rb', line 42 def scheme @scheme ||= generate_with(:scheme) || (request.respond_to?(:scheme) and request.scheme) end |
#url ⇒ Object
62 63 64 65 66 |
# File 'lib/usher/util/generate.rb', line 62 def url path.route.generate_with.nil? || path.route.generate_with.empty? ? request.url : protocol + host + port_string end |