Class: MojangApi::Whitelist::Base
- Inherits:
-
Object
- Object
- MojangApi::Whitelist::Base
- Defined in:
- lib/mojang_api/whitelist/base.rb
Instance Attribute Summary collapse
-
#profiles ⇒ Object
readonly
Returns the value of attribute profiles.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(profiles = []) ⇒ Base
constructor
A new instance of Base.
- #load_from(filename) ⇒ Object
- #save_to(filename) ⇒ Object
- #to_s ⇒ Object
- #to_version(version) ⇒ Object
Constructor Details
#initialize(profiles = []) ⇒ Base
Returns a new instance of Base.
6 7 8 |
# File 'lib/mojang_api/whitelist/base.rb', line 6 def initialize(profiles = []) @profiles = profiles end |
Instance Attribute Details
#profiles ⇒ Object (readonly)
Returns the value of attribute profiles.
4 5 6 |
# File 'lib/mojang_api/whitelist/base.rb', line 4 def profiles @profiles end |
Class Method Details
.load_from(filename) ⇒ Object
37 38 39 40 41 |
# File 'lib/mojang_api/whitelist/base.rb', line 37 def load_from(filename) instance = new instance.load_from(filename) instance end |
Instance Method Details
#load_from(filename) ⇒ Object
10 11 12 13 14 15 |
# 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) ⇒ Object
21 22 23 |
# File 'lib/mojang_api/whitelist/base.rb', line 21 def save_to(filename) File.open(filename, "w") { |f| f.write(serialize) } end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/mojang_api/whitelist/base.rb', line 17 def to_s serialize end |