class Eyemask::Core::Loader
Public Class Methods
new(options={})
click to toggle source
# File lib/eyemask/core/loader.rb, line 6 def initialize(options={}) @options = options @contents = [] end
Public Instance Methods
contents()
click to toggle source
# File lib/eyemask/core/loader.rb, line 30 def contents @contents.sort{|a, b| a["uri"] <=> b["uri"] } end
document()
click to toggle source
# File lib/eyemask/core/loader.rb, line 19 def document doc = {} doc["contents"] = contents doc["title"] = @options[:title] doc["subtitle"] = @options[:subtitle] doc["authors"] = @options[:authors] doc["logo"] = @options[:logo] doc["params"] = @options[:params] doc end
done()
click to toggle source
# File lib/eyemask/core/loader.rb, line 15 def done # DO NOTHING, HERE AS A HOOK end
load(uri, data)
click to toggle source
# File lib/eyemask/core/loader.rb, line 11 def load(uri, data) @contents.concat(to_elements(uri, data)) end
Private Instance Methods
to_elements(uri, data)
click to toggle source
# File lib/eyemask/core/loader.rb, line 36 def to_elements(uri, data) begin JSON.parse(data) rescue JSON::ParserError [] end end