Class: OpsmanagerClient::Product

Inherits:
Object
  • Object
show all
Defined in:
lib/opsmanager_client/product.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Product

Returns a new instance of Product.



15
16
17
# File 'lib/opsmanager_client/product.rb', line 15

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



13
14
15
# File 'lib/opsmanager_client/product.rb', line 13

def path
  @path
end

Instance Method Details

#fileObject



31
32
33
# File 'lib/opsmanager_client/product.rb', line 31

def file
  File.open(path)
end

#nameObject



23
24
25
# File 'lib/opsmanager_client/product.rb', line 23

def name
  filename_without_extension[/(p\-[a-z0-9]+)\-/i, 1]
end

#to_sObject



19
20
21
# File 'lib/opsmanager_client/product.rb', line 19

def to_s
  "#{name} v#{version}"
end

#versionObject



27
28
29
# File 'lib/opsmanager_client/product.rb', line 27

def version
  filename_without_extension[/#{name}\-(.+)$/, 1]
end