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
80 81 82 83 84 85 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 80 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.
87 88 89 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 87 def symbolic_name @symbolic_name end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
87 88 89 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 87 def version @version end |
Instance Method Details
#find_entries(path, pattern, recurse) ⇒ Object
93 94 95 96 97 98 99 100 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 93 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
89 90 91 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 89 def state INSTALLED end |