-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |