Class: Urbit::Links
- Inherits:
-
Set
- Object
- Set
- Urbit::Links
- Defined in:
- lib/urbit/links.rb
Instance Attribute Summary collapse
-
#ship ⇒ Object
readonly
Returns the value of attribute ship.
Instance Method Summary collapse
- #[](path:) ⇒ Object
- #find_graph(resource:) ⇒ Object
- #find_graph_links_for_group(path:) ⇒ Object
- #find_group(path:) ⇒ Object
-
#initialize ⇒ Links
constructor
A new instance of Links.
- #list ⇒ Object
- #load(ship:) ⇒ Object
Constructor Details
#initialize ⇒ Links
Returns a new instance of Links.
7 8 9 10 |
# File 'lib/urbit/links.rb', line 7 def initialize @hash = {} @ship = nil end |
Instance Attribute Details
#ship ⇒ Object (readonly)
Returns the value of attribute ship.
5 6 7 |
# File 'lib/urbit/links.rb', line 5 def ship @ship end |
Instance Method Details
#[](path:) ⇒ Object
12 13 14 |
# File 'lib/urbit/links.rb', line 12 def [](path:) self.select {|l| path == l.path}.first end |
#find_graph(resource:) ⇒ Object
16 17 18 |
# File 'lib/urbit/links.rb', line 16 def find_graph(resource:) self.select{|l| l.type == 'graph' && resource == l.graph_resource}.first end |
#find_graph_links_for_group(path:) ⇒ Object
20 21 22 |
# File 'lib/urbit/links.rb', line 20 def find_graph_links_for_group(path:) self.select{|l| l.type == 'graph' && path == l.group_path} end |
#find_group(path:) ⇒ Object
24 25 26 |
# File 'lib/urbit/links.rb', line 24 def find_group(path:) self.select{|l| l.type == 'groups' && path == l.group_path}.first end |
#list ⇒ Object
28 29 30 31 |
# File 'lib/urbit/links.rb', line 28 def list self.sort.each {|l| puts l.to_list} nil end |
#load(ship:) ⇒ Object
33 34 35 36 37 |
# File 'lib/urbit/links.rb', line 33 def load(ship:) ship.subscribe(app: 'metadata-store', path: '/all') @ship = ship nil end |