Class: Appwrite::Topic
- Inherits:
-
Object
- Object
- Appwrite::Topic
- Defined in:
- lib/appwrite/topic.rb
Overview
Class Method Summary collapse
-
.path(levels) ⇒ Object
Start a topic with the given levels, e.g.
Instance Method Summary collapse
-
#initialize(levels) ⇒ Topic
constructor
A new instance of Topic.
-
#path(levels) ⇒ Object
Append the given levels.
- #to_s ⇒ Object
Constructor Details
#initialize(levels) ⇒ Topic
Returns a new instance of Topic.
14 15 16 |
# File 'lib/appwrite/topic.rb', line 14 def initialize(levels) @levels = levels.freeze end |
Class Method Details
.path(levels) ⇒ Object
Start a topic with the given levels, e.g. Topic.path(['user', user_id]).
10 11 12 |
# File 'lib/appwrite/topic.rb', line 10 def self.path(levels) new([]).path(levels) end |
Instance Method Details
#path(levels) ⇒ Object
Append the given levels.
19 20 21 |
# File 'lib/appwrite/topic.rb', line 19 def path(levels) self.class.send(:new, @levels + self.class.send(:levels_of, levels)) end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/appwrite/topic.rb', line 23 def to_s @levels.join('/') end |