Class: OodAppkit::Url

Inherits:
Object
  • Object
show all
Defined in:
lib/ood_appkit/url.rb

Overview

A generic class used to handle URLs for an app

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title: '', base_url: '/', template: '{/url*}/') ⇒ Url

Returns a new instance of Url.



14
15
16
17
18
# File 'lib/ood_appkit/url.rb', line 14

def initialize(title: '', base_url: '/', template: '{/url*}/')
  @title = title.to_s
  @template = Addressable::Template.new template.to_s
  @base_url = parse_url_segments(base_url.to_s)
end

Instance Attribute Details

#titleString (readonly)

The title for this URL



8
9
10
# File 'lib/ood_appkit/url.rb', line 8

def title
  @title
end

Instance Method Details

#urlAddressable::URI

URL to access this app



22
23
24
# File 'lib/ood_appkit/url.rb', line 22

def url
  @template.expand url: @base_url
end