Class: JsonClient::Pather
- Inherits:
-
Object
- Object
- JsonClient::Pather
- Defined in:
- lib/json_client/pather.rb
Instance Attribute Summary collapse
-
#ext ⇒ Object
readonly
Returns the value of attribute ext.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(host, ext, name) ⇒ Pather
constructor
A new instance of Pather.
- #path(id = nil) ⇒ Object
Constructor Details
#initialize(host, ext, name) ⇒ Pather
Returns a new instance of Pather.
6 7 8 9 10 |
# File 'lib/json_client/pather.rb', line 6 def initialize(host, ext, name) @host = host @ext = ext @name = name end |
Instance Attribute Details
#ext ⇒ Object (readonly)
Returns the value of attribute ext.
4 5 6 |
# File 'lib/json_client/pather.rb', line 4 def ext @ext end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
4 5 6 |
# File 'lib/json_client/pather.rb', line 4 def host @host end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/json_client/pather.rb', line 4 def name @name end |
Instance Method Details
#path(id = nil) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/json_client/pather.rb', line 12 def path(id = nil) if id.nil? "#{host}/#{ext}/#{name}" else "#{host}/#{ext}/#{name}/#{id}" end end |