Class: Urbit::Fact::SettingsEventFact
Instance Attribute Summary
Attributes inherited from BaseFact
#ack, #channel, #data, #type
Instance Method Summary
collapse
Methods inherited from BaseFact
#add_ack, #contents, #create_parser, #for_this_ship?, #graph_update?, #is_acknowledged?, #raw_json, #ship, #to_s
Constructor Details
Returns a new instance of SettingsEventFact.
7
8
9
10
|
# File 'lib/urbit/fact/settings_fact.rb', line 7
def initialize(channel:, event:)
super channel: channel, event: event
self.accept if self.for_this_ship?
end
|
Instance Method Details
#accept ⇒ Object
12
13
14
|
# File 'lib/urbit/fact/settings_fact.rb', line 12
def accept
nil
end
|
#base_contents ⇒ Object
16
17
18
|
# File 'lib/urbit/fact/settings_fact.rb', line 16
def base_contents
JSON.parse(@data)["json"]["settings-event"]
end
|
#bucket ⇒ Object
20
21
22
|
# File 'lib/urbit/fact/settings_fact.rb', line 20
def bucket
self.desk[bucket: self.bucket_key]
end
|
#bucket_key ⇒ Object
24
25
26
|
# File 'lib/urbit/fact/settings_fact.rb', line 24
def bucket_key
self.contents["bucket-key"]
end
|
#desk ⇒ Object
28
29
30
|
# File 'lib/urbit/fact/settings_fact.rb', line 28
def desk
self.ship.settings[desk: self.desk_name]
end
|
#desk_name ⇒ Object
32
33
34
|
# File 'lib/urbit/fact/settings_fact.rb', line 32
def desk_name
self.contents["desk"]
end
|
#to_h ⇒ Object
36
37
38
39
40
41
|
# File 'lib/urbit/fact/settings_fact.rb', line 36
def to_h
super.merge!({
bucket: self.bucket_key,
desk: self.desk_name,
})
end
|