Class: Urbit::Fact::SettingsEventPutBucketFact

Inherits:
SettingsEventFact show all
Defined in:
lib/urbit/fact/settings_fact.rb

Instance Attribute Summary

Attributes inherited from BaseFact

#ack, #channel, #data, #type

Instance Method Summary collapse

Methods inherited from SettingsEventFact

#base_contents, #bucket, #bucket_key, #desk, #desk_name, #initialize

Methods inherited from BaseFact

#add_ack, #create_parser, #for_this_ship?, #graph_update?, #initialize, #is_acknowledged?, #raw_json, #ship, #to_s

Constructor Details

This class inherits a constructor from Urbit::Fact::SettingsEventFact

Instance Method Details

#acceptObject



69
70
71
72
73
74
# File 'lib/urbit/fact/settings_fact.rb', line 69

def accept
  # This is a new bucket, add it.
  s = channel.ship.settings[desk: self.desk_name]
  s.buckets << Bucket.new(setting: s, name: self.bucket_key, entries: self.entries)
  nil
end

#contentsObject



76
77
78
# File 'lib/urbit/fact/settings_fact.rb', line 76

def contents
  self.base_contents["put-bucket"]
end

#entriesObject



80
81
82
# File 'lib/urbit/fact/settings_fact.rb', line 80

def entries
  self.contents["bucket"]
end

#to_hObject



84
85
86
87
88
# File 'lib/urbit/fact/settings_fact.rb', line 84

def to_h
  super.merge!({
    entries: self.entries
  })
end