Class: OpenHAB::DSL::Imports::Bundle
- Inherits:
-
Object
- Object
- OpenHAB::DSL::Imports::Bundle
- Defined in:
- lib/rspec/openhab/dsl/imports.rb
Constant Summary collapse
- INSTALLED =
2
Instance Attribute Summary collapse
-
#symbolic_name ⇒ Object
readonly
Returns the value of attribute symbolic_name.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #find_entries(path, pattern, recurse) ⇒ Object
-
#initialize(*jar_args) ⇒ Bundle
constructor
A new instance of Bundle.
- #state ⇒ Object
Constructor Details
#initialize(*jar_args) ⇒ Bundle
Returns a new instance of Bundle.
87 88 89 90 91 92 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 87 def initialize(*jar_args) file = Jars.find_jar(*jar_args) @jar = java.util.jar.JarFile.new(file) @symbolic_name = jar_args[1] @version = org.osgi.framework.Version.new(jar_args[2].tr("-", ".")) end |
Instance Attribute Details
#symbolic_name ⇒ Object (readonly)
Returns the value of attribute symbolic_name.
94 95 96 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 94 def symbolic_name @symbolic_name end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
94 95 96 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 94 def version @version end |
Instance Method Details
#find_entries(path, pattern, recurse) ⇒ Object
100 101 102 103 104 105 106 107 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 100 def find_entries(path, pattern, recurse) pattern ||= recurse ? "**" : "*" full_pattern = File.join(path, pattern) entries = @jar.entries.select do |e| File.fnmatch(full_pattern, e.name) end java.util.Collections.enumeration(entries.map { |e| java.net.URL.new("jar:file://#{@jar.name}!/#{e.name}") }) end |
#state ⇒ Object
96 97 98 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 96 def state INSTALLED end |