Module: Cenit::API::UrlSlug
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#slug ⇒ Object
readonly
Returns the value of attribute slug.
Instance Method Summary collapse
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
5 6 7 |
# File 'lib/cenit/api/url_slug.rb', line 5 def parent @parent end |
#slug ⇒ Object (readonly)
Returns the value of attribute slug.
5 6 7 |
# File 'lib/cenit/api/url_slug.rb', line 5 def slug @slug end |
Instance Method Details
#initialize(slug, parent = nil) ⇒ Object
7 8 9 10 |
# File 'lib/cenit/api/url_slug.rb', line 7 def initialize(slug, parent = nil) @slug = slug @parent = parent end |
#url ⇒ Object
12 13 14 15 |
# File 'lib/cenit/api/url_slug.rb', line 12 def url url = parent ? parent.url : '' "#{url}/#{slug}" end |