lib/meibo/roster.rb in meibo-0.18.0 vs lib/meibo/roster.rb in meibo-0.19.0
- old
+ new
@@ -16,9 +16,17 @@
Reader.open_buffer(io, profile: profile) do |reader|
return read_data(reader, profile)
end
end
+ def open(io_or_path, **opts)
+ m = io_or_path.kind_of?(IO) ? :from_buffer : :from_file
+ roster = public_send(m, io_or_path, **opts)
+ return roster unless block_given?
+
+ Meibo.with_roster(roster) { yield roster }
+ end
+
private
def read_data(reader, profile)
begin
manifest = reader.manifest