Class: TentD::TentType
- Inherits:
-
Object
- Object
- TentD::TentType
- Defined in:
- lib/tentd/tent_type.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
Returns the value of attribute base.
-
#version ⇒ Object
Returns the value of attribute version.
-
#view ⇒ Object
Returns the value of attribute view.
Instance Method Summary collapse
-
#initialize(uri = nil) ⇒ TentType
constructor
A new instance of TentType.
- #uri ⇒ Object
Constructor Details
#initialize(uri = nil) ⇒ TentType
Returns a new instance of TentType.
5 6 7 8 9 10 11 12 |
# File 'lib/tentd/tent_type.rb', line 5 def initialize(uri = nil) if uri @version = TentVersion.from_uri(uri) view_split = uri.to_s.split('#') @view = view_split[1] @base = view_split[0].to_s.sub(%r{/v[^a-z/][^/]*$}, '') end end |
Instance Attribute Details
#base ⇒ Object
Returns the value of attribute base.
3 4 5 |
# File 'lib/tentd/tent_type.rb', line 3 def base @base end |
#version ⇒ Object
Returns the value of attribute version.
3 4 5 |
# File 'lib/tentd/tent_type.rb', line 3 def version @version end |
#view ⇒ Object
Returns the value of attribute view.
3 4 5 |
# File 'lib/tentd/tent_type.rb', line 3 def view @view end |
Instance Method Details
#uri ⇒ Object
14 15 16 17 18 |
# File 'lib/tentd/tent_type.rb', line 14 def uri version_part = @version.nil? ? '' : "/v#{@version}" view_part = @view.nil? ? '' : "##{@view}" "#{@base}#{version_part}#{view_part}" end |