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.
106 107 108 109 110 111 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 106 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.
113 114 115 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 113 def symbolic_name @symbolic_name end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
113 114 115 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 113 def version @version end |
Instance Method Details
#find_entries(path, pattern, recurse) ⇒ Object
119 120 121 122 123 124 125 126 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 119 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
115 116 117 |
# File 'lib/rspec/openhab/dsl/imports.rb', line 115 def state INSTALLED end |