class MojangApi::Whitelist::Base

Attributes

profiles[R]

Public Class Methods

load_from(filename) click to toggle source
# File lib/mojang_api/whitelist/base.rb, line 37
def load_from(filename)
  instance = new
  instance.load_from(filename)
  instance
end
new(profiles = []) click to toggle source
# File lib/mojang_api/whitelist/base.rb, line 6
def initialize(profiles = [])
  @profiles = profiles
end

Public Instance Methods

load_from(filename) click to toggle source
# File lib/mojang_api/whitelist/base.rb, line 10
def load_from(filename)
  f = File.open(filename, "r")
  parse f
  f.close
  self
end
save_to(filename) click to toggle source
# File lib/mojang_api/whitelist/base.rb, line 21
def save_to(filename)
  File.open(filename, "w") { |f| f.write(serialize) }
end
to_s() click to toggle source
# File lib/mojang_api/whitelist/base.rb, line 17
def to_s
  serialize
end
to_version(version) click to toggle source
# File lib/mojang_api/whitelist/base.rb, line 25
def to_version(version)
  case version
  when :v16
    OneSix.new(@profiles.dup)
  when :v17
    OneSeven.new(@profiles.dup)
  else
    raise "No such version!"
  end
end

Protected Instance Methods

parse(input) click to toggle source
# File lib/mojang_api/whitelist/base.rb, line 45
def parse(input)
  raise 'Not Implemented'
end
serialize() click to toggle source
# File lib/mojang_api/whitelist/base.rb, line 49
def serialize
  raise 'Not Implemented'
end