class KerbalStuff::Mod

Attributes

json[R]

Public Class Methods

new(json) click to toggle source
# File lib/kerbalstuff/mod.rb, line 6
def initialize json
        @json = json
        
        @name = @json['name']
        @background = @json['background']
        @license = @json['license']
        @website = @json['website']
        @donations = @json['donations']
        @source_code = @json['source_code']
        @author = @json['author']
        @downloads = @json['downloads']
        @id = @json['id']
        @short_description = @json['short_description']
        @description_html = @json['description_html']
        @followers = @json['followers']
        @default_version_id = @json['default_version_id']
        @description = @json['description']
        
        if @json.has_key?('versions')
                @versions = []
                if @json['versions'].length > 0
                        @json['versions'].each do |v|
                                @versions.push(ModVersion.new(v))
                        end
                end
        end
        
end

Public Instance Methods

to_s() click to toggle source
# File lib/kerbalstuff/mod.rb, line 35
def to_s
        return ["name=#{@name}", "background=https:""/""/""cdn.mediacru.sh#{@background}", "license=#{@license}", "website=#{@website}", "donations=#{@donations}", "source_code=#{@source_code}", "author=#{@author}", "downloads=#{@downloads}", "id=#{@id}", "short_description=\"#{@short_description}\"", "versions=#{@versions}", "description_html=\"#{@description_html}\"", "followers=#{@followers}", "default_version_id=#{@default_version_id}", "description=\"#{@description}\""]
end