Class: Urbit::Links

Inherits:
Set
  • Object
show all
Defined in:
lib/urbit/links.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLinks

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

#shipObject (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


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

#listObject



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