Module: Arduino::Library::InstanceMethods
Overview
These are the DSL methods that can be imported by requiring ‘arduino/library/include’
Instance Method Summary collapse
- #db_default ⇒ Object
- #db_from(file_or_url) ⇒ Object
-
#library_from(file_or_url) ⇒ Object
file_or_urlcan be a JSON file name, a .properties file name, or a URL to either of the above. -
#search(database = db_default, **opts) ⇒ Object
optsis a Hash that you can use to pass attributes with values, any number of them.
Instance Method Details
#db_default ⇒ Object
14 15 16 |
# File 'lib/arduino/library/instance_methods.rb', line 14 def db_default DefaultDatabase.instance end |
#db_from(file_or_url) ⇒ Object
10 11 12 |
# File 'lib/arduino/library/instance_methods.rb', line 10 def db_from(file_or_url) Database.new(file_or_url) end |
#library_from(file_or_url) ⇒ Object
file_or_url can be a JSON file name, a .properties file name, or a URL to either of the above.
23 24 25 |
# File 'lib/arduino/library/instance_methods.rb', line 23 def library_from(file_or_url) Arduino::Library::Model.from(file_or_url) end |
#search(database = db_default, **opts) ⇒ Object
opts is a Hash that you can use to pass attributes with values, any number of them. All matching results are returned as models.
name: 'AudioZero'
author: /konstantin/i - regexp supported
architectures: [ 'avr' ] - array is matched if it's a subset
version: proc do |value| — or a proc for max flexibility
value.start_with?('1.') )
end
40 41 42 43 |
# File 'lib/arduino/library/instance_methods.rb', line 40 def search(database = db_default, **opts) Arduino::Library::Model.database = database database.search(**opts) end |