lib/arli/library.rb in arli-1.1.0 vs lib/arli/library.rb in arli-1.2.1
- old
+ new
@@ -3,10 +3,12 @@
require 'arduino/library/model'
require 'arli/errors'
module Arli
module Library
+ ADDITIONAL_KEYS = %i(depends headers_only)
+
def library_model(lib)
return lib if lib.is_a?(::Arduino::Library::Model)
::Arduino::Library::Model.from(lib).tap do |model|
if model.nil?
lib_output = (lib && lib['name']) ? lib['name'] : lib.to_s
@@ -18,10 +20,22 @@
end
end
end
def make_lib(lib)
- ::Arli::Library::SingleVersion.new(library_model(lib))
+ additional_keys = {}
+ ADDITIONAL_KEYS.each do |k|
+ if lib.is_a?(Hash) && lib[k]
+ additional_keys[k] = lib[k]
+ lib.delete(k)
+ end
+ end
+
+ ::Arli::Library::SingleVersion.new(library_model(lib)).tap do |svlib|
+ additional_keys.each_pair do |key, value|
+ svlib.send("#{key}=", value)
+ end
+ end
end
end
end