Class: Arli::Library::SingleVersion
- Inherits:
-
Object
- Object
- Arli::Library::SingleVersion
- Defined in:
- lib/arli/library/single_version.rb
Overview
Represents a wrapper around Arduino::Library::Model instance and decorates with a few additional helpers.
Instance Attribute Summary collapse
-
#canonical_dir ⇒ Object
Returns the value of attribute canonical_dir.
-
#config ⇒ Object
Returns the value of attribute config.
-
#depends ⇒ Object
Additional attributes that can be set via Arlifile.
-
#folder ⇒ Object
Additional attributes that can be set via Arlifile.
-
#headers_only ⇒ Object
Additional attributes that can be set via Arlifile.
-
#lib ⇒ Object
Returns the value of attribute lib.
-
#lib_dir ⇒ Object
Returns the value of attribute lib_dir.
Instance Method Summary collapse
- #dir ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(lib, config: Arli.config) ⇒ SingleVersion
constructor
A new instance of SingleVersion.
- #inspect ⇒ Object
- #install ⇒ Object
- #installer ⇒ Object
- #libraries_home ⇒ Object
- #method_missing(method, *args, &block) ⇒ Object
- #path ⇒ Object
- #temp_dir ⇒ Object
- #temp_path ⇒ Object
Constructor Details
#initialize(lib, config: Arli.config) ⇒ SingleVersion
Returns a new instance of SingleVersion.
22 23 24 25 26 27 28 29 |
# File 'lib/arli/library/single_version.rb', line 22 def initialize(lib, config: Arli.config) self.lib = lib self.config = config self.lib_dir = lib.name.gsub(/ /, '_') self.headers_only = false self.depends = nil self.folder = nil end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
69 70 71 72 73 74 75 |
# File 'lib/arli/library/single_version.rb', line 69 def method_missing(method, *args, &block) if lib && lib.respond_to?(method) lib.send(method, *args, &block) else super(method, *args, &block) end end |
Instance Attribute Details
#canonical_dir ⇒ Object
Returns the value of attribute canonical_dir.
12 13 14 |
# File 'lib/arli/library/single_version.rb', line 12 def canonical_dir @canonical_dir end |
#config ⇒ Object
Returns the value of attribute config.
12 13 14 |
# File 'lib/arli/library/single_version.rb', line 12 def config @config end |
#depends ⇒ Object
Additional attributes that can be set via Arlifile
18 19 20 |
# File 'lib/arli/library/single_version.rb', line 18 def depends @depends end |
#folder ⇒ Object
Additional attributes that can be set via Arlifile
18 19 20 |
# File 'lib/arli/library/single_version.rb', line 18 def folder @folder end |
#headers_only ⇒ Object
Additional attributes that can be set via Arlifile
18 19 20 |
# File 'lib/arli/library/single_version.rb', line 18 def headers_only @headers_only end |
#lib ⇒ Object
Returns the value of attribute lib.
12 13 14 |
# File 'lib/arli/library/single_version.rb', line 12 def lib @lib end |
#lib_dir ⇒ Object
Returns the value of attribute lib_dir.
12 13 14 |
# File 'lib/arli/library/single_version.rb', line 12 def lib_dir @lib_dir end |
Instance Method Details
#dir ⇒ Object
47 48 49 |
# File 'lib/arli/library/single_version.rb', line 47 def dir canonical_dir || lib_dir end |
#exists? ⇒ Boolean
59 60 61 |
# File 'lib/arli/library/single_version.rb', line 59 def exists? Dir.exist?(path) end |
#inspect ⇒ Object
63 64 65 66 67 |
# File 'lib/arli/library/single_version.rb', line 63 def inspect <<-EOF Library: #{lib.name} (#{lib.url}), only headers? #{headers_only ? 'YES' : 'NO'} EOF end |
#install ⇒ Object
31 32 33 |
# File 'lib/arli/library/single_version.rb', line 31 def install installer.install end |
#installer ⇒ Object
35 36 37 |
# File 'lib/arli/library/single_version.rb', line 35 def installer @installer ||= Installer.new(self) end |
#libraries_home ⇒ Object
39 40 41 |
# File 'lib/arli/library/single_version.rb', line 39 def libraries_home config.libraries.path end |
#path ⇒ Object
51 52 53 |
# File 'lib/arli/library/single_version.rb', line 51 def path libraries_home + '/' + dir end |
#temp_dir ⇒ Object
43 44 45 |
# File 'lib/arli/library/single_version.rb', line 43 def temp_dir config.libraries.temp_dir end |
#temp_path ⇒ Object
55 56 57 |
# File 'lib/arli/library/single_version.rb', line 55 def temp_path temp_dir + '/' + dir end |