class IdobataFs
Public Instance Methods
can_write?(path)
click to toggle source
# File idobata_fs.rb, line 23 def can_write?(path) file?(path) end
contents(path)
click to toggle source
# File idobata_fs.rb, line 4 def contents(path) _, org, room_name = path.split(?/, 3) if org.empty? organizations elsif organizations.include?(org) && room_name.nil? room_names end end
directory?(path)
click to toggle source
# File idobata_fs.rb, line 14 def directory?(path) _, org, room_name = path.split(?/, 3) organizations.include?(org) && room_name.nil? end
file?(path)
click to toggle source
# File idobata_fs.rb, line 19 def file?(path) room_for(path) end
write_to(path, body)
click to toggle source
# File idobata_fs.rb, line 27 def write_to(path, body) return if body.empty? IdobataGraphQL.create_message(room_for(path).id, <<~BODY) ~~~ #{body} ~~~ BODY end
Private Instance Methods
organizations()
click to toggle source
# File idobata_fs.rb, line 43 def organizations @organizations ||= rooms.map(&:organization).uniq end
room_for(path)
click to toggle source
# File idobata_fs.rb, line 38 def room_for(path) _, org, room_name = path.split(?/, 3) rooms.detect { |r| r.organization == org && r.name == room_name } end
room_names()
click to toggle source
# File idobata_fs.rb, line 47 def room_names @room_names ||= rooms.map(&:name) end
rooms()
click to toggle source
# File idobata_fs.rb, line 51 def rooms @rooms ||= IdobataGraphQL.rooms end