diff --git a/lib/eve_online.rb b/lib/eve_online.rb index 423a21834..5791f769b 100644 --- a/lib/eve_online.rb +++ b/lib/eve_online.rb @@ -75,6 +75,8 @@ require 'eve_online/sde/type_ids' require 'eve_online/sde/type_id' +require 'eve_online/sde/blueprints' +require 'eve_online/sde/blueprint' module EveOnline end diff --git a/lib/eve_online/sde/blueprint.rb b/lib/eve_online/sde/blueprint.rb new file mode 100644 index 000000000..31907247c --- /dev/null +++ b/lib/eve_online/sde/blueprint.rb @@ -0,0 +1,26 @@ +module EveOnline + module SDE + class Blueprint + attr_reader :options + + def initialize(options) + @options = options + end + + def as_json + { + type_id: type_id, + data: data + } + end + + def type_id + @type_id ||= options.first + end + + def data + @data ||= options.last + end + end + end +end diff --git a/lib/eve_online/sde/blueprints.rb b/lib/eve_online/sde/blueprints.rb new file mode 100644 index 000000000..ebba80b8a --- /dev/null +++ b/lib/eve_online/sde/blueprints.rb @@ -0,0 +1,25 @@ +module EveOnline + module SDE + class Blueprints + attr_reader :file + + def initialize(file) + @file = file + end + + def blueprints + @type_ids ||= begin + output = [] + content.each do |entry| + output << Blueprint.new(entry) + end + output + end + end + + def content + @content ||= YAML.load(File.open(file)) + end + end + end +end